From 7b4c47623f03c858fa9b89397828b4f007b21e9f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 13 Mar 2014 20:19:30 +0000 Subject: [PATCH 01/72] Don't forget previous set "$packages" --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 00ff38a..60721b0 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2195,7 +2195,7 @@ install_centos_stable_deps() { packages="${packages} python26-setuptools" fi else - packages="PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2" + packages="${packages} PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" packages="${packages} python-pip" From f35ea6baaf1d11c25af6787757f118fd9b898c6d Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 15 Mar 2014 08:57:54 +0000 Subject: [PATCH 02/72] Properly detect Oracle Linux. Fixes #335. Fixes #271. --- bootstrap-salt.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 60721b0..5f31540 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -597,7 +597,7 @@ __strip_duplicates() { __sort_release_files() { KNOWN_RELEASE_FILES=$(echo "(arch|centos|debian|ubuntu|fedora|redhat|suse|\ mandrake|mandriva|gentoo|slackware|turbolinux|unitedlinux|lsb|system|\ - os)(-|_)(release|version)" | sed -r 's:[[:space:]]::g') + oracle|os)(-|_)(release|version)" | sed -r 's:[[:space:]]::g') primary_release_files="" secondary_release_files="" # Sort know VS un-known files first @@ -702,6 +702,7 @@ __gather_linux_system_info() { slackware ) n="Slackware" ;; turbolinux ) n="TurboLinux" ;; unitedlinux ) n="UnitedLinux" ;; + oracle ) n="Oracle Linux" ;; system ) while read -r line; do [ "${n}x" != "systemx" ] && break From efc9db7f57eb79d9128fab68d766bed798969907 Mon Sep 17 00:00:00 2001 From: briffle Date: Fri, 7 Mar 2014 00:33:16 -0600 Subject: [PATCH 03/72] Allow Oracle Entprise Linux to get treated the same as CentOS --- bootstrap-salt.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5f31540..74f892e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2581,6 +2581,71 @@ install_red_hat_enterprise_workstation_testing_post() { # ####################################################################################################################### +####################################################################################################################### +# +# Oracle Enterprise Linux Install Functions +# +install_enterpriseenterpriseserver_stable_deps() { + install_centos_stable_deps || return 1 + return 0 +} + +install_enterpriseenterpriseserver_git_deps() { + install_centos_git_deps || return 1 + return 0 +} + +install_enterpriseenterpriseserver_testing_deps() { + install_centos_testing_deps || return 1 + return 0 +} + +install_enterpriseenterpriseserver_stable() { + install_centos_stable || return 1 + return 0 +} + +install_enterpriseenterpriseserver_git() { + install_centos_git || return 1 + return 0 +} + +install_enterpriseenterpriseserver_testing() { + install_centos_testing || return 1 + return 0 +} + +install_enterpriseenterpriseserver_stable_post() { + install_centos_stable_post || return 1 + return 0 +} + +install_enterpriseenterpriseserver_git_post() { + install_centos_git_post || return 1 + return 0 +} + + +install_enterpriseenterpriseserver_testing_post() { + install_centos_testing_post || return 1 + return 0 +} + +install_enterpriseenterpriseserver_restart_daemons() { + install_centos_restart_daemons || return 1 + return 0 +} + +install_enterpriseenterpriseserver_check_services() { + install_centos_check_services || return 1 + return 0 +} +# +# Ended Oracle Enterprise Linux Install Functions +# +####################################################################################################################### + + ####################################################################################################################### # # Amazon Linux AMI Install Functions From 4139e36c8363d8bd626f8e96260c649c56f2c5c9 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 15 Mar 2014 16:35:31 +0000 Subject: [PATCH 04/72] Adapt the Oracle Linux install functions to proper matching ones. --- bootstrap-salt.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 74f892e..deb788e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2583,65 +2583,65 @@ install_red_hat_enterprise_workstation_testing_post() { ####################################################################################################################### # -# Oracle Enterprise Linux Install Functions +# Oracle Linux Install Functions # -install_enterpriseenterpriseserver_stable_deps() { +install_oracle_linux_stable_deps() { install_centos_stable_deps || return 1 return 0 } -install_enterpriseenterpriseserver_git_deps() { +install_oracle_linux_git_deps() { install_centos_git_deps || return 1 return 0 } -install_enterpriseenterpriseserver_testing_deps() { +install_oracle_linux_testing_deps() { install_centos_testing_deps || return 1 return 0 } -install_enterpriseenterpriseserver_stable() { +install_oracle_linux_stable() { install_centos_stable || return 1 return 0 } -install_enterpriseenterpriseserver_git() { +install_oracle_linux_git() { install_centos_git || return 1 return 0 } -install_enterpriseenterpriseserver_testing() { +install_oracle_linux_testing() { install_centos_testing || return 1 return 0 } -install_enterpriseenterpriseserver_stable_post() { +install_oracle_linux_stable_post() { install_centos_stable_post || return 1 return 0 } -install_enterpriseenterpriseserver_git_post() { +install_oracle_linux_git_post() { install_centos_git_post || return 1 return 0 } -install_enterpriseenterpriseserver_testing_post() { +install_oracle_linux_testing_post() { install_centos_testing_post || return 1 return 0 } -install_enterpriseenterpriseserver_restart_daemons() { +install_oracle_linux_restart_daemons() { install_centos_restart_daemons || return 1 return 0 } -install_enterpriseenterpriseserver_check_services() { +install_oracle_linux_check_services() { install_centos_check_services || return 1 return 0 } # -# Ended Oracle Enterprise Linux Install Functions +# Ended Oracle Linux Install Functions # ####################################################################################################################### From 8bdf1770c4dfa6b8169c10fbc1c8e0af9ffc158a Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 15 Mar 2014 16:56:16 +0000 Subject: [PATCH 05/72] Add Oracle Linux to supported distributions list --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 9694efc..3a9bbed 100644 --- a/README.rst +++ b/README.rst @@ -362,6 +362,7 @@ Supported Operating Systems - Linaro - Linux Mint 13/14 - OpenSUSE 12.x +- Oracle Linux 5/5 - Red Hat 5/6 - Red Hat Enterprise 5/6 - SmartOS From db730cf3e723aa1009a18da121506b74deac57c6 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sat, 15 Mar 2014 16:56:49 +0000 Subject: [PATCH 06/72] Update changes log --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index d5c5364..8462fb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Version 2014.XX.XX: + * Fixed a bug for RHEL 6 based distributions where yum-utils was not getting installed. + * Allow detection of and installation on Oracle Linux systems + Version 2014.03.10-1: * Distro Support Fixed: * Fix the Debian services running function From 3d46d53bd00c34ebcb33785c4e1832635b619464 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 19 Mar 2014 19:10:27 +0000 Subject: [PATCH 07/72] Properly detect Scientific Linux. Refs #343. --- bootstrap-salt.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index deb788e..3c902cd 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -642,15 +642,15 @@ __gather_linux_system_info() { rv=$(lsb_release >/dev/null 2>&1) if [ $? -eq 0 ]; then DISTRO_NAME=$(lsb_release -si) - if [ "x$(echo "$DISTRO_NAME" | grep RedHat)" != "x" ]; then + if [ "${DISTRO_NAME}" = "Scientific" ]; then + DISTRO_NAME="Scientific Linux" + elif [ "x$(echo "$DISTRO_NAME" | grep RedHat)" != "x" ]; then # Let's convert CamelCase to Camel Case DISTRO_NAME=$(__camelcase_split "$DISTRO_NAME") - fi - if [ "${DISTRO_NAME}" = "openSUSE project" ]; then + elif [ "${DISTRO_NAME}" = "openSUSE project" ]; then # lsb_release -si returns "openSUSE project" on openSUSE 12.3 DISTRO_NAME="opensuse" - fi - if [ "${DISTRO_NAME}" = "SUSE LINUX" ]; then + elif [ "${DISTRO_NAME}" = "SUSE LINUX" ]; then # lsb_release -si returns "SUSE LINUX" on SLES 11 SP3 DISTRO_NAME="suse" fi @@ -685,6 +685,8 @@ __gather_linux_system_info() { redhat ) if [ ".$(egrep 'CentOS' /etc/${rsource})" != . ]; then n="CentOS" + elif [ ".$(egrep 'Scientific' /etc/${rsource})" != . ]; then + n="Scientific Linux" elif [ ".$(egrep 'Red Hat Enterprise Linux' /etc/${rsource})" != . ]; then n="ed at nterprise inux" else From 6f2f962e1ee7518515cb40010c450c52fd04335a Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 19 Mar 2014 19:11:18 +0000 Subject: [PATCH 08/72] Properly support Scientific Linux. Fixes #343. --- bootstrap-salt.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3c902cd..5f88127 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2583,6 +2583,7 @@ install_red_hat_enterprise_workstation_testing_post() { # ####################################################################################################################### + ####################################################################################################################### # # Oracle Linux Install Functions @@ -2648,6 +2649,71 @@ install_oracle_linux_check_services() { ####################################################################################################################### +####################################################################################################################### +# +# Scientific Linux Install Functions +# +install_scientific_linux_stable_deps() { + install_centos_stable_deps || return 1 + return 0 +} + +install_scientific_linux_git_deps() { + install_centos_git_deps || return 1 + return 0 +} + +install_scientific_linux_testing_deps() { + install_centos_testing_deps || return 1 + return 0 +} + +install_scientific_linux_stable() { + install_centos_stable || return 1 + return 0 +} + +install_scientific_linux_git() { + install_centos_git || return 1 + return 0 +} + +install_scientific_linux_testing() { + install_centos_testing || return 1 + return 0 +} + +install_scientific_linux_stable_post() { + install_centos_stable_post || return 1 + return 0 +} + +install_scientific_linux_git_post() { + install_centos_git_post || return 1 + return 0 +} + + +install_scientific_linux_testing_post() { + install_centos_testing_post || return 1 + return 0 +} + +install_scientific_linux_restart_daemons() { + install_centos_restart_daemons || return 1 + return 0 +} + +install_scientific_linux_check_services() { + install_centos_check_services || return 1 + return 0 +} +# +# Ended Scientific Linux Install Functions +# +####################################################################################################################### + + ####################################################################################################################### # # Amazon Linux AMI Install Functions From af0c00a104855c36be8a93ceed694c4f6a938336 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 19 Mar 2014 19:25:38 +0000 Subject: [PATCH 09/72] Add Scientific Linux to the supported distributions. --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index 3a9bbed..3221d8c 100644 --- a/README.rst +++ b/README.rst @@ -365,6 +365,7 @@ Supported Operating Systems - Oracle Linux 5/5 - Red Hat 5/6 - Red Hat Enterprise 5/6 +- Scientific Linux 5/6 - SmartOS - SuSE 11 SP1/11 SP2 - Ubuntu 10.x/11.x/12.x/13.04/13.10 From 82789f9e04e812abde0861aa102de83f299d5a31 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 19 Mar 2014 19:27:14 +0000 Subject: [PATCH 10/72] Update changes log --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8462fb0..1de2f15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ Version 2014.XX.XX: * Fixed a bug for RHEL 6 based distributions where yum-utils was not getting installed. - * Allow detection of and installation on Oracle Linux systems + * Distro Support Addded: + * Oracle Linux + * Scientific Linux Version 2014.03.10-1: * Distro Support Fixed: From c6e14e2f0414b67f105f9b17dbe44c840979ba7e Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 13:51:27 +0100 Subject: [PATCH 11/72] Fix minor typo --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5f88127..8b29212 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -346,7 +346,7 @@ fi # Check that we're installing a minion if we're being passed a master address if [ $_INSTALL_MINION -eq $BS_FALSE ] && [ $_SALT_MASTER_ADDRESS != "null" ]; then - echoerror "Don't pass a master address(-A) if no minion is going to be bootstrapped." + echoerror "Don't pass a master address (-A) if no minion is going to be bootstrapped." exit 1 fi From a8dc4789d4b7c5cbf411155ef85cb1551b55764f Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 13:52:22 +0100 Subject: [PATCH 12/72] gitignore vim swap files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d8fe4fa..f7834ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /.project +*.swp From 1ef5695787d701cca2aa959ff28b2f96625bf6b2 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 13:52:54 +0100 Subject: [PATCH 13/72] Add support for preseeding minion id --- bootstrap-salt.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5f88127..1aba8ee 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -220,6 +220,8 @@ usage() { example, pass '--no-check-certificate' to 'wget' or '--insecure' to 'curl' -A Pass the salt-master DNS name or IP. This will be stored under \${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf + -i Pass the salt-minion id. This will be stored under + \${BS_SALT_ETC_DIR}/minion.d/98-minion-id.conf -L Install the Apache Libcloud package if possible(required for salt-cloud) -p Extra-package to install while installing salt dependencies. One package per -p flag. You're responsible for providing the proper package name. @@ -255,12 +257,13 @@ _WGET_ARGS=${BS_WGET_ARGS:-} _CURL_ARGS=${BS_CURL_ARGS:-} _FETCH_ARGS=${BS_FETCH_ARGS:-} _SALT_MASTER_ADDRESS="null" +_SALT_MINION_ID="null" # __SIMPLIFY_VERSION is mostly used in Solaris based distributions __SIMPLIFY_VERSION=$BS_TRUE _LIBCLOUD_MIN_VERSION="0.14.0" _EXTRA_PACKAGES="" -while getopts ":hvnDc:g:k:MSNXCPFUKIA:Lp:" opt +while getopts ":hvnDc:g:k:MSNXCPFUKIA:i:Lp:" opt do case "${opt}" in @@ -299,6 +302,7 @@ do K ) _KEEP_TEMP_FILES=$BS_TRUE ;; I ) _INSECURE_DL=$BS_TRUE ;; A ) _SALT_MASTER_ADDRESS=$OPTARG ;; + i ) _SALT_MINION_ID=$OPTARG ;; L ) _INSTALL_CLOUD=$BS_TRUE ;; p ) _EXTRA_PACKAGES="$_EXTRA_PACKAGES $OPTARG" ;; @@ -350,6 +354,12 @@ if [ $_INSTALL_MINION -eq $BS_FALSE ] && [ $_SALT_MASTER_ADDRESS != "null" ]; th exit 1 fi +# Check that we're installing a minion if we're being passed a master address +if [ $_INSTALL_MINION -eq $BS_FALSE ] && [ $_SALT_MINION_ID != "null" ]; then + echoerror "Don't pass a minion id (-i) if no minion is going to be bootstrapped." + exit 1 +fi + # Define installation type if [ "$#" -eq 0 ];then @@ -4187,6 +4197,14 @@ master: $_SALT_MASTER_ADDRESS _eof fi +# Drop the minion id if passed +if [ $_SALT_MINION_ID != "null" ]; then + [ ! -d $_SALT_ETC_DIR/minion.d ] && mkdir -p $_SALT_ETC_DIR/minion.d + cat <<_eof > $_SALT_ETC_DIR/minion.d/99-minion-id.conf +id: $_SALT_MINION_ID +_eof +fi + # Run any post install function. Only execute function if not in config mode only if [ $_CONFIG_ONLY -eq $BS_FALSE ] && [ "$POST_INSTALL_FUNC" != "null" ]; then echoinfo "Running ${POST_INSTALL_FUNC}()" From 9918052a4631ea4ead7f72752f87564f480c6add Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 14:13:38 +0100 Subject: [PATCH 14/72] Also set `$_SALT_ETC_DIR/minion_d` This is technically not necessary since `id:` overrides it, but I think it's more transparent. --- bootstrap-salt.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1aba8ee..d0008c1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4203,6 +4203,9 @@ if [ $_SALT_MINION_ID != "null" ]; then cat <<_eof > $_SALT_ETC_DIR/minion.d/99-minion-id.conf id: $_SALT_MINION_ID _eof + # Technically not necessary, but preseeding this one, too, to keep things + # transparent. + echo $_SALT_MINION_ID > $_SALT_ETC_DIR/minion_id fi # Run any post install function. Only execute function if not in config mode only From 2194a973e2e80b6da24cd500159c0dd0d1a098c2 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 14:25:36 +0100 Subject: [PATCH 15/72] Not preseeding `99-minion-id.conf` It's not necessary. `$_SALT_ETC_DIR/minion_id` is enough. --- bootstrap-salt.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d0008c1..c05b4bc 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -221,7 +221,7 @@ usage() { -A Pass the salt-master DNS name or IP. This will be stored under \${BS_SALT_ETC_DIR}/minion.d/99-master-address.conf -i Pass the salt-minion id. This will be stored under - \${BS_SALT_ETC_DIR}/minion.d/98-minion-id.conf + \${BS_SALT_ETC_DIR}/minion_id -L Install the Apache Libcloud package if possible(required for salt-cloud) -p Extra-package to install while installing salt dependencies. One package per -p flag. You're responsible for providing the proper package name. @@ -4199,12 +4199,6 @@ fi # Drop the minion id if passed if [ $_SALT_MINION_ID != "null" ]; then - [ ! -d $_SALT_ETC_DIR/minion.d ] && mkdir -p $_SALT_ETC_DIR/minion.d - cat <<_eof > $_SALT_ETC_DIR/minion.d/99-minion-id.conf -id: $_SALT_MINION_ID -_eof - # Technically not necessary, but preseeding this one, too, to keep things - # transparent. echo $_SALT_MINION_ID > $_SALT_ETC_DIR/minion_id fi From b77176211c3db3d0f12616c0d27ced5d70127b3a Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 14:26:18 +0100 Subject: [PATCH 16/72] Make sure $_SALT_ETC_DIR is created Defensive programming... --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index c05b4bc..8f078b4 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -4199,6 +4199,7 @@ fi # Drop the minion id if passed if [ $_SALT_MINION_ID != "null" ]; then + [ ! -d $_SALT_ETC_DIR ] && mkdir -p $_SALT_ETC_DIR echo $_SALT_MINION_ID > $_SALT_ETC_DIR/minion_id fi From 7beb852dcc8006479abb669ab67bc8da2d42e888 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 14:33:17 +0100 Subject: [PATCH 17/72] Add a Vagrant file It mounts its own directory in `/salt_bootstrao` on the VM. --- Vagrantfile | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 Vagrantfile diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..94166f9 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,118 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # All Vagrant configuration is done here. The most common configuration + # options are documented and commented below. For a complete reference, + # please see the online documentation at vagrantup.com. + + # Every Vagrant virtual environment requires a box to build off of. + config.vm.box = "precise64" + + # The url from where the 'config.vm.box' box will be fetched if it + # doesn't already exist on the user's system. + # config.vm.box_url = "http://domain.com/path/to/above.box" + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # config.vm.network :forwarded_port, guest: 80, host: 8080 + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network :private_network, ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network :public_network + + # If true, then any SSH connections made will enable agent forwarding. + # Default value: false + # config.ssh.forward_agent = true + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + config.vm.synced_folder ".", "/salt_bootstrap" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider :virtualbox do |vb| + # # Don't boot with headless mode + # vb.gui = true + # + # # Use VBoxManage to customize the VM. For example to change memory: + # vb.customize ["modifyvm", :id, "--memory", "1024"] + # end + # + # View the documentation for the provider you're using for more + # information on available options. + + # Enable provisioning with Puppet stand alone. Puppet manifests + # are contained in a directory path relative to this Vagrantfile. + # You will need to create the manifests directory and a manifest in + # the file precise64.pp in the manifests_path directory. + # + # An example Puppet manifest to provision the message of the day: + # + # # group { "puppet": + # # ensure => "present", + # # } + # # + # # File { owner => 0, group => 0, mode => 0644 } + # # + # # file { '/etc/motd': + # # content => "Welcome to your Vagrant-built virtual machine! + # # Managed by Puppet.\n" + # # } + # + # config.vm.provision :puppet do |puppet| + # puppet.manifests_path = "manifests" + # puppet.manifest_file = "site.pp" + # end + + # Enable provisioning with chef solo, specifying a cookbooks path, roles + # path, and data_bags path (all relative to this Vagrantfile), and adding + # some recipes and/or roles. + # + # config.vm.provision :chef_solo do |chef| + # chef.cookbooks_path = "../my-recipes/cookbooks" + # chef.roles_path = "../my-recipes/roles" + # chef.data_bags_path = "../my-recipes/data_bags" + # chef.add_recipe "mysql" + # chef.add_role "web" + # + # # You may also specify custom JSON attributes: + # chef.json = { :mysql_password => "foo" } + # end + + # Enable provisioning with chef server, specifying the chef server URL, + # and the path to the validation key (relative to this Vagrantfile). + # + # The Opscode Platform uses HTTPS. Substitute your organization for + # ORGNAME in the URL and validation key. + # + # If you have your own Chef Server, use the appropriate URL, which may be + # HTTP instead of HTTPS depending on your configuration. Also change the + # validation key to validation.pem. + # + # config.vm.provision :chef_client do |chef| + # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME" + # chef.validation_key_path = "ORGNAME-validator.pem" + # end + # + # If you're using the Opscode platform, your validator client is + # ORGNAME-validator, replacing ORGNAME with your organization name. + # + # If you have your own Chef Server, the default validation client name is + # chef-validator, unless you changed the configuration. + # + # chef.validation_client_name = "ORGNAME-validator" +end From cafb8e30b96c812e10b7ad616acfe927a990d280 Mon Sep 17 00:00:00 2001 From: Jens Rantil Date: Fri, 21 Mar 2014 14:36:29 +0100 Subject: [PATCH 18/72] Document vagrant in README --- README.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.rst b/README.rst index 3221d8c..8d22a9f 100644 --- a/README.rst +++ b/README.rst @@ -393,4 +393,14 @@ If after trying this, you still see the same problems, then, please `file an iss .. _`Salt`: http://saltstack.org/ .. _`file an issue`: https://github.com/saltstack/salt-bootstrap/issues/new +Testing in Vagrant +------------------ +You can use Vagrant_ to easily test changes on a clean machine. The ``Vagrantfile`` defaults to an Ubuntu box. First, install Vagrant, then:: + + $ vagrant up + $ vagrant ssh + $ cd /salt_bootstrap + $ sudo sh salt-bootstrap.sh + +.. _Vagrant: http://www.vagrantup.com .. vim: fenc=utf-8 spell spl=en cc=100 tw=99 fo=want sts=2 sw=2 et From d926f8a51c1319bb30ae9cefee201a05d471bf5e Mon Sep 17 00:00:00 2001 From: Armagan Kimyonoglu Date: Tue, 25 Mar 2014 12:25:26 +0200 Subject: [PATCH 19/72] Rhel optional channel may have suffix after major version --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 8b29212..fd236c5 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2389,7 +2389,7 @@ install_red_hat_linux_stable_deps() { else OPTIONAL_ARCH=$CPU_ARCH_L fi - if [ $DISTRO_MAJOR_VERSION -eq 6 ] && [ "X$(rhn-channel -l | grep optional)" != "Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}" ]; then + if [ $DISTRO_MAJOR_VERSION -eq 6 ] && [[ "X$(rhn-channel -l | grep optional)" != Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ]]; then echoerror "Failed to find RHN optional repo, please enable it using the GUI or rhn-channel command." return 1 fi From a1968d9dfb1e61f57651920fd263e9c146658bd9 Mon Sep 17 00:00:00 2001 From: Armagan Kimyonoglu Date: Tue, 25 Mar 2014 14:51:26 +0200 Subject: [PATCH 20/72] Changelog for optional channel fix --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 1de2f15..2e8ba07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ Version 2014.XX.XX: * Fixed a bug for RHEL 6 based distributions where yum-utils was not getting installed. + * Added minor version check for RHEL 6 optional channel. * Distro Support Addded: * Oracle Linux * Scientific Linux From 82371b772c48f196c01279dffe28e916eeadc73b Mon Sep 17 00:00:00 2001 From: Armagan Kimyonoglu Date: Tue, 25 Mar 2014 17:38:30 +0200 Subject: [PATCH 21/72] don't use double square brackes --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index fd236c5..249fdec 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2389,7 +2389,7 @@ install_red_hat_linux_stable_deps() { else OPTIONAL_ARCH=$CPU_ARCH_L fi - if [ $DISTRO_MAJOR_VERSION -eq 6 ] && [[ "X$(rhn-channel -l | grep optional)" != Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ]]; then + if [ $DISTRO_MAJOR_VERSION -eq 6 ] && case "X$(rhn-channel -l | grep optional)" in Xrhel-${OPTIONAL_ARCH}-server-optional-${DISTRO_MAJOR_VERSION}* ) false ;; * ) true ;; esac ; then echoerror "Failed to find RHN optional repo, please enable it using the GUI or rhn-channel command." return 1 fi From c74ea3f54246a8c8a0aa26670cd72ac9a9c2f6b8 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Wed, 2 Apr 2014 15:07:17 -0700 Subject: [PATCH 22/72] add missing space before ] --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a9e8466..5e70170 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3383,7 +3383,7 @@ install_opensuse_stable_deps() { packages="libzmq3 python python-Jinja2 python-M2Crypto python-PyYAML " packages="${packages} python-msgpack-python python-pycrypto python-pyzmq python-xml" - if [ $_INSTALL_CLOUD -eq $BS_TRUE]; then + if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then packages="${packages} python-apache-libcloud" fi From 391a012a7479a9a0ecc604bfa32071ad9558d3a3 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 05:21:43 +0100 Subject: [PATCH 23/72] Fix SC1000: `$` is not used specially and should therefore be escaped. --- bootstrap-salt.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5e70170..763742f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -184,13 +184,13 @@ usage() { - git Examples: - $ ${__ScriptName} - $ ${__ScriptName} stable - $ ${__ScriptName} daily - $ ${__ScriptName} git - $ ${__ScriptName} git develop - $ ${__ScriptName} git v0.17.0 - $ ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357 + \$ ${__ScriptName} + \$ ${__ScriptName} stable + \$ ${__ScriptName} daily + \$ ${__ScriptName} git + \$ ${__ScriptName} git develop + \$ ${__ScriptName} git v0.17.0 + \$ ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357 Options: -h Display this message From e2c2a1cbccf061a40cfeb1aa0f0a2237c14a130e Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 05:27:51 +0100 Subject: [PATCH 24/72] Fix SC2003: `expr` is antiquated. Consider rewriting this using `$((..))`, `${}` or `[[ ]]`. --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 763742f..5380e35 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3957,11 +3957,11 @@ daemons_running() { if [ "${DISTRO_NAME}" = "SmartOS" ]; then if [ "$(svcs -Ho STA salt-$fname)" != "ON" ]; then echoerror "salt-$fname was not found running" - FAILED_DAEMONS=$(expr $FAILED_DAEMONS + 1) + FAILED_DAEMONS=$((FAILED_DAEMONS + 1)) fi elif [ "x$(ps wwwaux | grep -v grep | grep salt-$fname)" = "x" ]; then echoerror "salt-$fname was not found running" - FAILED_DAEMONS=$(expr $FAILED_DAEMONS + 1) + FAILED_DAEMONS=$((FAILED_DAEMONS + 1)) fi done return $FAILED_DAEMONS From 86d723d91ebe63a47a149185da4ab28bd85d3bb2 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 05:29:00 +0100 Subject: [PATCH 25/72] Fix SC2004: `$` on variables in `(( ))` is unnecessary. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5380e35..f92ff34 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -315,7 +315,7 @@ do esac # --- end of case --- done -shift $(($OPTIND-1)) +shift $((OPTIND-1)) __check_unparsed_options() { From 23b7809c83f53d6cac994318b632f71ed47d4335 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 05:40:01 +0100 Subject: [PATCH 26/72] Fix SC2045. Iterate over globs whenever possible. Iterate over globs whenever possible (e.g. 'for f in */*.wav'), as for loops over ls will fail for filenames like 'my file*.txt'. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index f92ff34..a132b83 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3920,7 +3920,7 @@ preseed_master() { SEED_DEST="$_PKI_DIR/master/minions" [ -d $SEED_DEST ] || mkdir -p $SEED_DEST && chmod 700 $SEED_DEST || return 1 - for keyfile in $(ls $_TEMP_KEYS_DIR); do + for keyfile in $_TEMP_KEYS_DIR/*; do src_keyfile="${_TEMP_KEYS_DIR}/${keyfile}" dst_keyfile="${SEED_DEST}/${keyfile}" From 5459761c5516f331676c3daf3082f7fb86280304 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 05:42:25 +0100 Subject: [PATCH 27/72] Fix SC2120. `__apt_get_upgrade_noinput` references arguments, but none are ever passed. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index a132b83..4001aa8 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1053,7 +1053,7 @@ __apt_get_install_noinput() { # DESCRIPTION: (DRY) apt-get upgrade with noinput options #---------------------------------------------------------------------------------------------------------------------- __apt_get_upgrade_noinput() { - apt-get upgrade -y -o DPkg::Options::=--force-confold $@; return $? + apt-get upgrade -y -o DPkg::Options::=--force-confold; return $? } From e827e708bb5534a4f4a909a1632ff16e57772673 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 05:46:11 +0100 Subject: [PATCH 28/72] Fix SC2091. Remove surrounding $() to avoid executing output. --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4001aa8..b206617 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -795,7 +795,7 @@ __gather_sunos_system_info() { DISTRO_NAME="Solaris" # Let's make sure we not actually on a Joyent's SmartOS VM since some releases # don't have SmartOS in `/etc/release`, only `Solaris` - $(uname -v | grep joyent >/dev/null 2>&1) + uname -v | grep joyent >/dev/null 2>&1 if [ $? -eq 0 ]; then DISTRO_NAME="SmartOS" fi @@ -3356,7 +3356,7 @@ install_opensuse_stable_deps() { DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}" # Is the repository already known - $(zypper repos | grep devel_languages_python >/dev/null 2>&1) + zypper repos | grep devel_languages_python >/dev/null 2>&1 if [ $? -eq 1 ]; then # zypper does not yet know nothing about devel_languages_python zypper --non-interactive addrepo --refresh \ @@ -3529,7 +3529,7 @@ install_suse_11_stable_deps() { DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}" # Is the repository already known - $(zypper repos | grep devel_languages_python >/dev/null 2>&1) + zypper repos | grep devel_languages_python >/dev/null 2>&1 if [ $? -eq 1 ]; then # zypper does not yet know nothing about devel_languages_python zypper --non-interactive addrepo --refresh \ From 308b62b26b4ac1e2d5ef704e3855205b1b7e51f2 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 05:49:55 +0100 Subject: [PATCH 29/72] Fix SC2059. Don't use variables in the printf format string. Use printf "..%s.." "$foo". --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b206617..1740b13 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -71,7 +71,7 @@ __detect_color_support # DESCRIPTION: Echo errors to stderr. #---------------------------------------------------------------------------------------------------------------------- echoerror() { - printf "${RC} * ERROR${EC}: $@\n" 1>&2; + printf "${RC} * ERROR${EC}: %s\n" "$@" 1>&2; } #--- FUNCTION ------------------------------------------------------------------------------------------------------- From 58024f79ac527d5ed079eb613fd9c79894f3553c Mon Sep 17 00:00:00 2001 From: oreh Date: Fri, 4 Apr 2014 15:52:43 +0800 Subject: [PATCH 30/72] Avoid leaving unnecesary file after boostrap install. pip-python treats the version requirement, ">=", as an output redirection. As a result, a "=0.1.40" file is created when installing libcloud. --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1740b13..298687e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2222,7 +2222,7 @@ install_centos_stable_deps() { if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then easy_install-2.6 apache-libcloud>=$_LIBCLOUD_MIN_VERSION else - pip-python install apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip-python install "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi fi @@ -2753,7 +2753,7 @@ install_amazon_linux_ami_deps() { if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" - pip-python install apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip-python install "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi if [ "x${_EXTRA_PACKAGES}" != "x" ]; then From 8c764d54288fff4538057bde6a880f750a4fe84a Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 07:39:30 +0100 Subject: [PATCH 31/72] Install the Debian keys. Fixes #359. --- bootstrap-salt.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 298687e..1a52cac 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1698,6 +1698,9 @@ install_debian_deps() { apt-get update + # Install Keys + __apt_get_install_noinput debian-archive-keyring + if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" __apt_get_install_noinput python-pip @@ -1723,6 +1726,11 @@ install_debian_6_deps() { # No user interaction, libc6 restart services for example export DEBIAN_FRONTEND=noninteractive + apt-get update + + # Install Keys + __apt_get_install_noinput debian-archive-keyring + wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 if [ $_PIP_ALLOWED -eq $BS_TRUE ]; then @@ -1802,6 +1810,10 @@ install_debian_7_deps() { # No user interaction, libc6 restart services for example export DEBIAN_FRONTEND=noninteractive + apt-get update + # Install Keys + __apt_get_install_noinput debian-archive-keyring + # Saltstack's Stable Debian repository if [ "x$(grep -R 'wheezy-saltstack' /etc/apt)" = "x" ]; then echo "deb http://debian.saltstack.com/debian wheezy-saltstack main" >> \ @@ -1872,6 +1884,10 @@ install_debian_git_deps() { export DEBIAN_FRONTEND=noninteractive apt-get update + + # Install Keys + __apt_get_install_noinput debian-archive-keyring + __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \ python-jinja2 python-m2crypto python-yaml msgpack-python python-pip \ git || return 1 From 7827ba5c5e7aaff3708762ad37cf55f431c8f709 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 07:40:37 +0100 Subject: [PATCH 32/72] Also install Debian keyring on Ubuntu. Just in case. --- bootstrap-salt.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1a52cac..83d2743 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1485,7 +1485,12 @@ install_ubuntu_deps() { if [ $_START_DAEMONS -eq $BS_FALSE ]; then echowarn "Not starting daemons on Debian based distributions is not working mostly because starting them is the default behaviour." fi + apt-get update + + # Install Keys + __apt_get_install_noinput debian-archive-keyring + if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -eq 10 ]); then # Above Ubuntu 12.04 add-apt-repository is in a different package __apt_get_install_noinput software-properties-common || return 1 From d10b523193d6e8e85281aadbf5b0908e589118d7 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Thu, 3 Apr 2014 07:46:32 +0100 Subject: [PATCH 33/72] Stop complaining about `$` needing escape --- bootstrap-salt.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 83d2743..164feb0 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -184,13 +184,13 @@ usage() { - git Examples: - \$ ${__ScriptName} - \$ ${__ScriptName} stable - \$ ${__ScriptName} daily - \$ ${__ScriptName} git - \$ ${__ScriptName} git develop - \$ ${__ScriptName} git v0.17.0 - \$ ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357 + - ${__ScriptName} + - ${__ScriptName} stable + - ${__ScriptName} daily + - ${__ScriptName} git + - ${__ScriptName} git develop + - ${__ScriptName} git v0.17.0 + - ${__ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357 Options: -h Display this message From b26c3264d7767175a3e8421d3167e9f2f47057ff Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Apr 2014 12:55:30 +0100 Subject: [PATCH 34/72] Add Liu Xiaohui(@oreh) to AUTHORS --- AUTHORS.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.rst b/AUTHORS.rst index e8e82c5..bee1cfd 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -25,6 +25,7 @@ Jeff Hui jeffh jeff@jeffhui.net Jeff Strunk jstrunk Karl Grzeszczak karlgrz Kenneth Wilke KennethWilke +Liu Xiaohui oreh herolxh@gmail.com Matthew Willson ixela Matthieu Guegan mguegan Mike Carlson m87carlson mike@bayphoto.com From 87884d535b006222f4b91522ef85a30b18e5c8be Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Apr 2014 12:57:08 +0100 Subject: [PATCH 35/72] Add quotes around `apache-libcloud>=$_LIBCLOUD_MIN_VERSION` --- bootstrap-salt.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 164feb0..5a4d965 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1515,7 +1515,7 @@ install_ubuntu_deps() { if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" __apt_get_install_noinput python-pip - pip install -U apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then @@ -1709,7 +1709,7 @@ install_debian_deps() { if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" __apt_get_install_noinput python-pip - pip install -U apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then @@ -1791,7 +1791,7 @@ _eof if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" - pip install -U apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then @@ -1861,7 +1861,7 @@ _eof if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" - pip install -U apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then @@ -1907,7 +1907,7 @@ install_debian_git_deps() { if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" - pip install -U apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then @@ -2241,7 +2241,7 @@ install_centos_stable_deps() { if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then - easy_install-2.6 apache-libcloud>=$_LIBCLOUD_MIN_VERSION + easy_install-2.6 "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" else pip-python install "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -3753,7 +3753,7 @@ __gentoo_post_dep() { if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" __emerge -v 'dev-python/pip' - pip install -U apache-libcloud>=$_LIBCLOUD_MIN_VERSION + pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi __emerge -vo 'app-admin/salt' From c8ab98f600652d5853f863eb61749033fcfb3254 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Apr 2014 12:58:25 +0100 Subject: [PATCH 36/72] Update ChangeLog --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2e8ba07..4e2e590 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ Version 2014.XX.XX: * Fixed a bug for RHEL 6 based distributions where yum-utils was not getting installed. * Added minor version check for RHEL 6 optional channel. + * Added quotes around "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" for proper version requirements + handling. * Distro Support Addded: * Oracle Linux * Scientific Linux From df6c449fa981a0457ef355bf2e077546ef6fd838 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Apr 2014 13:23:40 +0100 Subject: [PATCH 37/72] Add the backports key to keyring. Update after installing keyring. --- bootstrap-salt.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5a4d965..fafb6e7 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1489,7 +1489,7 @@ install_ubuntu_deps() { apt-get update # Install Keys - __apt_get_install_noinput debian-archive-keyring + __apt_get_install_noinput debian-archive-keyring && apt-get update if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -eq 10 ]); then # Above Ubuntu 12.04 add-apt-repository is in a different package @@ -1704,7 +1704,7 @@ install_debian_deps() { apt-get update # Install Keys - __apt_get_install_noinput debian-archive-keyring + __apt_get_install_noinput debian-archive-keyring && apt-get update if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" @@ -1734,7 +1734,7 @@ install_debian_6_deps() { apt-get update # Install Keys - __apt_get_install_noinput debian-archive-keyring + __apt_get_install_noinput debian-archive-keyring && apt-get update wget $_WGET_ARGS -q http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key -O - | apt-key add - || return 1 @@ -1780,6 +1780,10 @@ _eof if [ "x$(grep -R 'backports.debian.org' /etc/apt)" = "x" ]; then echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> \ /etc/apt/sources.list.d/backports.list + + # Add the backports key + gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553 + gpg -a --export 8B48AD6246925553 | apt-key add - fi # Saltstack's Stable Debian repository @@ -1817,7 +1821,7 @@ install_debian_7_deps() { apt-get update # Install Keys - __apt_get_install_noinput debian-archive-keyring + __apt_get_install_noinput debian-archive-keyring && apt-get update # Saltstack's Stable Debian repository if [ "x$(grep -R 'wheezy-saltstack' /etc/apt)" = "x" ]; then @@ -1891,7 +1895,7 @@ install_debian_git_deps() { apt-get update # Install Keys - __apt_get_install_noinput debian-archive-keyring + __apt_get_install_noinput debian-archive-keyring && apt-get update __apt_get_install_noinput lsb-release python python-pkg-resources python-crypto \ python-jinja2 python-m2crypto python-yaml msgpack-python python-pip \ From cea2fb70578893b8e79ea0bfcca5c8158a13846d Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Apr 2014 13:28:27 +0100 Subject: [PATCH 38/72] Fix SC2068. Add double quotes around ${@}, otherwise it's just like $* and breaks on spaces. --- bootstrap-salt.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index fafb6e7..1d792fd 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -580,7 +580,7 @@ __parse_version_string() { # DESCRIPTION: Strip single or double quotes from the provided string. #---------------------------------------------------------------------------------------------------------------------- __unquote_string() { - echo $@ | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" + echo "${@}" | sed "s/^\([\"']\)\(.*\)\1\$/\2/g" } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -588,7 +588,7 @@ __unquote_string() { # DESCRIPTION: Convert CamelCased strings to Camel_Cased #---------------------------------------------------------------------------------------------------------------------- __camelcase_split() { - echo $@ | sed -r 's/([^A-Z-])([A-Z])/\1 \2/g' + echo "${@}" | sed -r 's/([^A-Z-])([A-Z])/\1 \2/g' } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -596,7 +596,7 @@ __camelcase_split() { # DESCRIPTION: Strip duplicate strings #---------------------------------------------------------------------------------------------------------------------- __strip_duplicates() { - echo $@ | tr -s '[:space:]' '\n' | awk '!x[$0]++' + echo "${@}" | tr -s '[:space:]' '\n' | awk '!x[$0]++' } #--- FUNCTION ------------------------------------------------------------------------------------------------------- @@ -611,7 +611,7 @@ __sort_release_files() { primary_release_files="" secondary_release_files="" # Sort know VS un-known files first - for release_file in $(echo $@ | sed -r 's:[[:space:]]:\n:g' | sort --unique --ignore-case); do + for release_file in $(echo "${@}" | sed -r 's:[[:space:]]:\n:g' | sort --unique --ignore-case); do match=$(echo $release_file | egrep -i ${KNOWN_RELEASE_FILES}) if [ "x${match}" != "x" ]; then primary_release_files="${primary_release_files} ${release_file}" @@ -1044,7 +1044,7 @@ __git_clone_and_checkout() { # DESCRIPTION: (DRY) apt-get install with noinput options #---------------------------------------------------------------------------------------------------------------------- __apt_get_install_noinput() { - apt-get install -y -o DPkg::Options::=--force-confold $@; return $? + apt-get install -y -o DPkg::Options::=--force-confold "${@}"; return $? } @@ -3716,9 +3716,9 @@ install_suse_check_services() { # __emerge() { if [ $_GENTOO_USE_BINHOST -eq $BS_TRUE ]; then - emerge --autounmask-write --getbinpkg $@; return $? + emerge --autounmask-write --getbinpkg "${@}"; return $? fi - emerge --autounmask-write $@; return $? + emerge --autounmask-write "${@}"; return $? } __gentoo_config_protection() { From 7ae660d4db175fd4288da15ba32401028600e05f Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 4 Apr 2014 13:34:13 +0100 Subject: [PATCH 39/72] Fix SC2046. Quote to prevent word splitting. --- bootstrap-salt.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1d792fd..4f91660 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -410,7 +410,7 @@ if [ "$(${whoami})" != "root" ]; then fi # Let's discover how we're being called -CALLER=$(echo `ps -a -o pid,args | grep $$ | grep -v grep | tr -s ' '` | cut -d ' ' -f 2) +CALLER="$(echo `ps -a -o pid,args | grep $$ | grep -v grep | tr -s ' '` | cut -d ' ' -f 2)" if [ "${CALLER}x" = "${0}x" ]; then CALLER="PIPED THROUGH" fi @@ -726,8 +726,8 @@ __gather_linux_system_info() { done < /etc/${rsource} ;; os ) - nn=$(__unquote_string $(grep '^ID=' /etc/os-release | sed -e 's/^ID=\(.*\)$/\1/g')) - rv=$(__unquote_string $(grep '^VERSION_ID=' /etc/os-release | sed -e 's/^VERSION_ID=\(.*\)$/\1/g')) + nn="$(__unquote_string $(grep '^ID=' /etc/os-release | sed -e 's/^ID=\(.*\)$/\1/g'))" + rv="$(__unquote_string $(grep '^VERSION_ID=' /etc/os-release | sed -e 's/^VERSION_ID=\(.*\)$/\1/g'))" [ "${rv}x" != "x" ] && v=$(__parse_version_string "$rv") || v="" case $(echo ${nn} | tr '[:upper:]' '[:lower:]') in arch ) @@ -1368,7 +1368,7 @@ __check_services_debian() { servicename=$1 echodebug "Checking if service ${servicename} is enabled" - if [ -f /etc/rc$(runlevel | awk '{ print $2 }').d/S*${servicename} ]; then + if [ -f "/etc/rc$(runlevel | awk '{ print $2 }').d/S*${servicename}" ]; then echodebug "Service ${servicename} is enabled" return 0 else From d58bdf1dede6c5df1020f039f2bc33754b8251e0 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 6 Apr 2014 15:08:04 +0100 Subject: [PATCH 40/72] Add `requests` as a required dependency for Debian installations. --- bootstrap-salt.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 4f91660..bbc24da 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1706,11 +1706,17 @@ install_debian_deps() { # Install Keys __apt_get_install_noinput debian-archive-keyring && apt-get update + # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 7 + # need to be installed using pip + check_pip_allowed "You need to allow pip based installations(-P) in order to install python-requests" + __apt_get_install_noinput python-pip + + __PIP_PACKAGES="requests" + if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" - __apt_get_install_noinput python-pip - pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" + __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" fi + pip install -U ${__PIP_PACKAGES} if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then __apt_get_upgrade_noinput || return 1 @@ -1793,10 +1799,16 @@ _eof fi apt-get update || return 1 + # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 7 + # need to be installed using pip + check_pip_allowed "You need to allow pip based installations(-P) in order to install python-requests" + + __PIP_PACKAGES="requests" + if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" - pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" + __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" fi + pip install -U ${__PIP_PACKAGES} if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then __apt_get_upgrade_noinput || return 1 @@ -1857,10 +1869,10 @@ _eof apt-get update __apt_get_install_noinput -t unstable libzmq3 libzmq3-dev || return 1 - __apt_get_install_noinput build-essential python-dev python-pip || return 1 + __apt_get_install_noinput build-essential python-dev python-pip python-requests || return 1 else apt-get update || return 1 - __apt_get_install_noinput python-zmq || return 1 + __apt_get_install_noinput python-zmq python-requests || return 1 fi if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then From ffa7ec2fe43563bc6f1ccfb93572b19f909442c1 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 6 Apr 2014 15:12:07 +0100 Subject: [PATCH 41/72] `python-requests` is also available through squeeze backports --- bootstrap-salt.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index bbc24da..bea2269 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1799,16 +1799,14 @@ _eof fi apt-get update || return 1 - # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 7 - # need to be installed using pip - check_pip_allowed "You need to allow pip based installations(-P) in order to install python-requests" - - __PIP_PACKAGES="requests" + # Python requests is available through Squeeze backports + __apt_get_install_noinput python-requests if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" + check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + __apt_get_install_noinput python-pip + pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi - pip install -U ${__PIP_PACKAGES} if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then __apt_get_upgrade_noinput || return 1 From 7b2057747615241e50004a29e7654ce3c1fa7da9 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 6 Apr 2014 15:19:12 +0100 Subject: [PATCH 42/72] Install procps and pciutils which allows Docker bootstraps See https://github.com/saltstack/salt-bootstrap/issues/366#issuecomment-39666813 --- bootstrap-salt.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index bea2269..759fd42 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1709,7 +1709,8 @@ install_debian_deps() { # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 7 # need to be installed using pip check_pip_allowed "You need to allow pip based installations(-P) in order to install python-requests" - __apt_get_install_noinput python-pip + # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + __apt_get_install_noinput python-pip procps pciutils __PIP_PACKAGES="requests" @@ -1800,7 +1801,8 @@ _eof apt-get update || return 1 # Python requests is available through Squeeze backports - __apt_get_install_noinput python-requests + # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + __apt_get_install_noinput python-requests python-pip procps pciutils if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" @@ -1867,10 +1869,17 @@ _eof apt-get update __apt_get_install_noinput -t unstable libzmq3 libzmq3-dev || return 1 - __apt_get_install_noinput build-essential python-dev python-pip python-requests || return 1 + __PACKAGES="build-essential python-dev python-pip python-requests" + # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + __PACKAGES="${__PACKAGES} procps pciutils" + __apt_get_install_noinput ${__PACKAGES} || return 1 else apt-get update || return 1 - __apt_get_install_noinput python-zmq python-requests || return 1 + __PACKAGES="python-zmq python-requests" + # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + __PACKAGES="${__PACKAGES} procps pciutils" + __apt_get_install_noinput ${__PACKAGES} || return 1 + fi if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then From 9e16bd6d6e57b82eb7fa850367047c634378c44c Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:26:04 +0100 Subject: [PATCH 43/72] The RedHat family now also installs `requests`. --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 759fd42..6f87480 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2245,14 +2245,14 @@ install_centos_stable_deps() { packages="yum-utils" if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then - packages="${packages} python26-PyYAML python26-m2crypto m2crypto python26 " + packages="${packages} python26-PyYAML python26-m2crypto m2crypto python26 python26-requests" packages="${packages} python26-crypto python26-msgpack python26-zmq python26-jinja2" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" packages="${packages} python26-setuptools" fi else - packages="${packages} PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2" + packages="${packages} PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2 python-requests" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" packages="${packages} python-pip" @@ -2786,7 +2786,7 @@ install_amazon_linux_ami_deps() { yum -y update || return 1 fi - packages="PyYAML m2crypto python-crypto python-msgpack python-zmq python-ordereddict python-jinja2" + packages="PyYAML m2crypto python-crypto python-msgpack python-zmq python-ordereddict python-jinja2 python-requests" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" From 79bb47bb1e82678e29f210a142ba049177c8b7e8 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:28:54 +0100 Subject: [PATCH 44/72] Arch also installs `requests` --- bootstrap-salt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 6f87480..469c582 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2889,9 +2889,9 @@ install_arch_linux_git_deps() { pacman -Sy --noconfirm --needed pacman || return 1 # Don't fail if un-installing python2-distribute threw an error pacman -R --noconfirm --needed python2-distribute - pacman -Sy --noconfirm --needed git python2-crypto python2-setuptools \ - python2-jinja python2-m2crypto python2-markupsafe python2-msgpack \ - python2-psutil python2-yaml python2-pyzmq zeromq || return 1 + pacman -Sy --noconfirm --needed git python2-crypto python2-setuptools python2-jinja \ + python2-m2crypto python2-markupsafe python2-msgpack python2-psutil python2-yaml \ + python2-pyzmq zeromq python2-requests || return 1 __git_clone_and_checkout || return 1 From aaa6d656067ece02a8a5e7b273e8fb585dcee925 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:38:48 +0100 Subject: [PATCH 45/72] Ubuntu now also installs `requests` --- bootstrap-salt.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 469c582..e54a97c 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1512,6 +1512,14 @@ install_ubuntu_deps() { # Minimal systems might not have upstart installed, install it __apt_get_install_noinput upstart + if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -eq 04 ]); then + __apt_get_install_noinput python-requests + else + check_pip_allowed "You need to allow pip based installations(-P) in order to install the python package 'requests'" + __apt_get_install_noinput python-pip + pip install requests + fi + if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" __apt_get_install_noinput python-pip From 5c216b7a5e940fe9692456fc178df7aad49c7445 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:40:50 +0100 Subject: [PATCH 46/72] Wording change --- bootstrap-salt.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e54a97c..105d2e0 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1520,6 +1520,18 @@ install_ubuntu_deps() { pip install requests fi + check_pip_allowed "You need to allow pip based installations(-P) in order to install the python 'requests' package" + # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 + __apt_get_install_noinput python-pip procps pciutils + + __PIP_PACKAGES="requests" + + if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then + __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" + fi + pip install -U ${__PIP_PACKAGES} + + if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" __apt_get_install_noinput python-pip @@ -1716,7 +1728,7 @@ install_debian_deps() { # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 7 # need to be installed using pip - check_pip_allowed "You need to allow pip based installations(-P) in order to install python-requests" + check_pip_allowed "You need to allow pip based installations(-P) in order to install the python 'requests' package" # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 __apt_get_install_noinput python-pip procps pciutils From 313861163af1c44627650670403858330b6ea760 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:42:01 +0100 Subject: [PATCH 47/72] Fedora now also installs `requests` --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 105d2e0..941b161 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2123,7 +2123,7 @@ install_debian_check_services() { # Fedora Install Functions # install_fedora_deps() { - packages="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq" + packages="yum-utils PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq python-requests" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then packages="${packages} python-libcloud" From e991da882c4bce84a3bcc2ed3bd9f5be5ff4bfa1 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:46:06 +0100 Subject: [PATCH 48/72] `requests` is also installed on FreeBSD --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 941b161..b169829 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3139,7 +3139,7 @@ config_freebsd_salt() { install_freebsd_git_deps() { install_freebsd_9_stable_deps || return 1 - /usr/local/sbin/pkg install -y git || return 1 + /usr/local/sbin/pkg install -y git www/py-requests || return 1 __git_clone_and_checkout || return 1 From fc95031021d11fdd95efc82d2bdfa1b14df6b494 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:50:28 +0100 Subject: [PATCH 49/72] Install `requests` in openSUSE --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index b169829..1a8fd86 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3444,7 +3444,7 @@ install_opensuse_stable_deps() { zypper --gpg-auto-import-keys --non-interactive update || return 1 fi - packages="libzmq3 python python-Jinja2 python-M2Crypto python-PyYAML " + packages="libzmq3 python python-Jinja2 python-M2Crypto python-PyYAML python-requests" packages="${packages} python-msgpack-python python-pycrypto python-pyzmq python-xml" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then From 140ae12c99a18b6575c50f3137bfe3dea78c20bf Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:51:38 +0100 Subject: [PATCH 50/72] Install `requests` in SuSE --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 1a8fd86..877ca98 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3607,7 +3607,7 @@ install_suse_11_stable_deps() { fi packages="libzmq3 python python-Jinja2 'python-M2Crypto>=0.21' python-msgpack-python" - packages="${packages} python-pycrypto python-pyzmq python-pip python-xml" + packages="${packages} python-pycrypto python-pyzmq python-pip python-xml python-requests" if [ $SUSE_PATCHLEVEL -eq 1 ]; then check_pip_allowed From 3fa483d4c0ed28a2402a13397c7dc20d254a51ac Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 19:52:53 +0100 Subject: [PATCH 51/72] Install `requests` in Gentoo --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 877ca98..5a29bbe 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3799,6 +3799,7 @@ __gentoo_post_dep() { pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi + __emerge -vo 'dev-python/requests' __emerge -vo 'app-admin/salt' if [ "x${_EXTRA_PACKAGES}" != "x" ]; then From 530e80380f88fc35078973a253f88b94528ad9f5 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 20:19:38 +0100 Subject: [PATCH 52/72] Update readme with info required to identify new distributions. --- README.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8d22a9f..4c17c62 100644 --- a/README.rst +++ b/README.rst @@ -393,9 +393,23 @@ If after trying this, you still see the same problems, then, please `file an iss .. _`Salt`: http://saltstack.org/ .. _`file an issue`: https://github.com/saltstack/salt-bootstrap/issues/new + +Unsupported Distro +------------------ + +You found out a Linux distribution which we still do not support or we do not correctly identify? +Please run the following commands when creating a ticket: + +.. code:: console + + sudo find /etc/ -name '*-release' -print -exec cat {} \; + which lsb_release && lsb_release -a + + Testing in Vagrant ------------------ -You can use Vagrant_ to easily test changes on a clean machine. The ``Vagrantfile`` defaults to an Ubuntu box. First, install Vagrant, then:: +You can use Vagrant_ to easily test changes on a clean machine. The ``Vagrantfile`` defaults to an +Ubuntu box. First, install Vagrant, then:: $ vagrant up $ vagrant ssh From 0c85bafe118a74d18296a31852c17de3ca2bcbab Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 20:21:57 +0100 Subject: [PATCH 53/72] Install `requests` in SmartOS --- bootstrap-salt.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 5a29bbe..2ec4f98 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3284,8 +3284,7 @@ install_freebsd_restart_daemons() { # install_smartos_deps() { pkgin -y install \ - zeromq py27-m2crypto py27-crypto py27-msgpack py27-yaml \ - py27-jinja2 py27-zmq || return 1 + zeromq py27-m2crypto py27-crypto py27-msgpack py27-yaml py27-jinja2 py27-zmq py27-requests || return 1 # Let's trigger config_salt() if [ "$_TEMP_CONFIG_DIR" = "null" ]; then From aac64a10271dccb2b706a3da81ef191ba464cd25 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 20:21:59 +0100 Subject: [PATCH 54/72] Update changes log --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 4e2e590..1cf7cd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ Version 2014.XX.XX: * Added minor version check for RHEL 6 optional channel. * Added quotes around "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" for proper version requirements handling. + * Install the python 'requests' package which is now a hard dependency in Salt. * Distro Support Addded: * Oracle Linux * Scientific Linux From 939bb8b9eb7ee46973944f0490686273f2ad01c5 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 20:23:16 +0100 Subject: [PATCH 55/72] Removed quotes which prevented globing. --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 2ec4f98..3b5c6d1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1368,7 +1368,7 @@ __check_services_debian() { servicename=$1 echodebug "Checking if service ${servicename} is enabled" - if [ -f "/etc/rc$(runlevel | awk '{ print $2 }').d/S*${servicename}" ]; then + if [ -f /etc/rc$(runlevel | awk '{ print $2 }').d/S*${servicename} ]; then echodebug "Service ${servicename} is enabled" return 0 else From 1d7dee80cb3946a0963be572b8bcf26495667cbf Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 20:59:12 +0100 Subject: [PATCH 56/72] Improve sentence. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 4c17c62..15b0eeb 100644 --- a/README.rst +++ b/README.rst @@ -398,7 +398,7 @@ Unsupported Distro ------------------ You found out a Linux distribution which we still do not support or we do not correctly identify? -Please run the following commands when creating a ticket: +Please run the following commands and report their output when creating a ticket: .. code:: console From 4f6e8578efdbb011cdcf37fc21d03f659ef73bb6 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 21:00:52 +0100 Subject: [PATCH 57/72] On versions higher than 12.04 --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 3b5c6d1..7c0987f 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1512,7 +1512,7 @@ install_ubuntu_deps() { # Minimal systems might not have upstart installed, install it __apt_get_install_noinput upstart - if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -eq 04 ]); then + if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -gt 03 ]); then __apt_get_install_noinput python-requests else check_pip_allowed "You need to allow pip based installations(-P) in order to install the python package 'requests'" From 153f76f440b01e2c57376103965ee261b651a9e2 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 22:28:04 +0100 Subject: [PATCH 58/72] Assure proper versioning with external Salt repositories. In case Salt is getting installed using a repository which is not SaltStack's Salt repository, add the latest as a remote and fetch tags from there for proper versioning. --- bootstrap-salt.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 7c0987f..321e471 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -237,6 +237,7 @@ EOT _KEEP_TEMP_FILES=${BS_KEEP_TEMP_FILES:-$BS_FALSE} _TEMP_CONFIG_DIR="null" _SALTSTACK_REPO_URL="git://github.com/saltstack/salt.git" +_SALT_REPO_URL=${_SALTSTACK_REPO_URL} _TEMP_KEYS_DIR="null" _INSTALL_MASTER=$BS_FALSE _INSTALL_SYNDIC=$BS_FALSE @@ -283,7 +284,7 @@ do exit 1 fi ;; - g ) _SALTSTACK_REPO_URL=$OPTARG ;; + g ) _SALT_REPO_URL=$OPTARG ;; k ) _TEMP_KEYS_DIR="$OPTARG" # If the configuration directory does not exist, error out if [ ! -d "$_TEMP_KEYS_DIR" ]; then @@ -1019,6 +1020,15 @@ __git_clone_and_checkout() { git fetch || return 1 # Tags are needed because of salt's versioning, also fetch that git fetch --tags || return 1 + + # If we have the SaltStack remote set as upstream, we also need to fetch the tags from there + if [ "x$(git remote -v | grep $_SALTSTACK_REPO_URL)" != "x" ]; then + git fetch --tags upstream + else + git remote add upstream $_SALTSTACK_REPO_URL + git fetch --tags upstream + fi + git reset --hard $GIT_REV || return 1 # Just calling `git reset --hard $GIT_REV` on a branch name that has @@ -1031,9 +1041,17 @@ __git_clone_and_checkout() { git pull --rebase || return 1 fi else - git clone $_SALTSTACK_REPO_URL || return 1 + git clone $_SALT_REPO_URL || return 1 cd $SALT_GIT_CHECKOUT_DIR + + if [ $_SALT_REPO_URL != $_SALTSTACK_REPO_URL ]; then + # We need to add the saltstack repository as a remote and fetch tags for proper versioning + git remote add upstream $_SALTSTACK_REPO_URL + git fetch --tags upstream + fi + git checkout $GIT_REV || return 1 + fi return 0 } From e102008cea8afa46b22f962b071560998fde3da2 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 7 Apr 2014 23:55:34 +0100 Subject: [PATCH 59/72] Update changes log --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1cf7cd1..ad1eebb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,8 @@ Version 2014.XX.XX: * Added quotes around "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" for proper version requirements handling. * Install the python 'requests' package which is now a hard dependency in Salt. + * When installing from a user defined repository add the official one as a remote and fetch + it's tags for proper versioning. * Distro Support Addded: * Oracle Linux * Scientific Linux From a4de9fb910b9f70528a2f6ae26b06aa55f5314de Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 8 Apr 2014 14:28:51 +0100 Subject: [PATCH 60/72] Reference the stable branch, not the develop one. --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 15b0eeb..7dd27ff 100644 --- a/README.rst +++ b/README.rst @@ -34,7 +34,7 @@ The URL used is just an HTTP redirect and as such it **will**, most likely, make ``wget`` or ``fetch`` (in FreeBSD >= 10), to complain about certificate issues. If this worries you, you **should not** use this URL. Use instead:: - https://github.com/saltstack/salt-bootstrap/raw/develop/bootstrap-salt.sh + https://github.com/saltstack/salt-bootstrap/raw/stable/bootstrap-salt.sh Examples From f2a4fd48bb765c8bbd0c5a31d19ee2b34fc421d4 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Wed, 9 Apr 2014 01:30:39 -0700 Subject: [PATCH 61/72] ChangeLog grammar fix --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ad1eebb..9348706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,7 +5,7 @@ Version 2014.XX.XX: handling. * Install the python 'requests' package which is now a hard dependency in Salt. * When installing from a user defined repository add the official one as a remote and fetch - it's tags for proper versioning. + its tags for proper versioning. * Distro Support Addded: * Oracle Linux * Scientific Linux From c2c3266ebbefa9737abce32fd9c8e89e9d8720c3 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Wed, 9 Apr 2014 01:34:08 -0700 Subject: [PATCH 62/72] grammar fix in README --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 7dd27ff..6ee429a 100644 --- a/README.rst +++ b/README.rst @@ -397,7 +397,7 @@ If after trying this, you still see the same problems, then, please `file an iss Unsupported Distro ------------------ -You found out a Linux distribution which we still do not support or we do not correctly identify? +You found a Linux distribution which we still do not support or we do not correctly identify? Please run the following commands and report their output when creating a ticket: .. code:: console From 300466927384cd8add8571bfc10fdb25c5b74a23 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 9 Apr 2014 13:10:08 +0100 Subject: [PATCH 63/72] Fix some pretty bad logic when installing requests on Ubuntu. Fixes #370. --- bootstrap-salt.sh | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 321e471..d748e04 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1532,28 +1532,27 @@ install_ubuntu_deps() { if [ $DISTRO_MAJOR_VERSION -gt 12 ] || ([ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -gt 03 ]); then __apt_get_install_noinput python-requests + __PIP_PACKAGES="" else - check_pip_allowed "You need to allow pip based installations(-P) in order to install the python package 'requests'" + check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package 'requests'" __apt_get_install_noinput python-pip + __PIP_PACKAGES="${__PIP_PACKAGES} requests" pip install requests fi - check_pip_allowed "You need to allow pip based installations(-P) in order to install the python 'requests' package" # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 - __apt_get_install_noinput python-pip procps pciutils - - __PIP_PACKAGES="requests" + __apt_get_install_noinput procps pciutils if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then + check_pip_allowed "You need to allow pip based installations (-P) in order to install 'apache-libcloud'" + if [ "x${__PIP_PACKAGES}" == "x" ]; then + __apt_get_install_noinput python-pip + fi __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" fi - pip install -U ${__PIP_PACKAGES} - - if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" - __apt_get_install_noinput python-pip - pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" + if [ "x${__PIP_PACKAGES}" != "x" ]; then + pip install -U ${__PIP_PACKAGES} fi if [ $_UPGRADE_SYS -eq $BS_TRUE ]; then @@ -1746,7 +1745,7 @@ install_debian_deps() { # Both python-requests which is a hard dependency and apache-libcloud which is a soft dependency, under debian < 7 # need to be installed using pip - check_pip_allowed "You need to allow pip based installations(-P) in order to install the python 'requests' package" + check_pip_allowed "You need to allow pip based installations (-P) in order to install the python 'requests' package" # Additionally install procps and pciutils which allows for Docker boostraps. See 366#issuecomment-39666813 __apt_get_install_noinput python-pip procps pciutils @@ -1843,7 +1842,7 @@ _eof __apt_get_install_noinput python-requests python-pip procps pciutils if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" __apt_get_install_noinput python-pip pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -1921,7 +1920,7 @@ _eof fi if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -1967,7 +1966,7 @@ install_debian_git_deps() { fi if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -2286,13 +2285,13 @@ install_centos_stable_deps() { packages="${packages} python26-PyYAML python26-m2crypto m2crypto python26 python26-requests" packages="${packages} python26-crypto python26-msgpack python26-zmq python26-jinja2" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" packages="${packages} python26-setuptools" fi else packages="${packages} PyYAML m2crypto python-crypto python-msgpack python-zmq python-jinja2 python-requests" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" packages="${packages} python-pip" fi fi @@ -2300,7 +2299,7 @@ install_centos_stable_deps() { yum -y install ${packages} --enablerepo=${_EPEL_REPO} || return 1 if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then easy_install-2.6 "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" else @@ -2827,14 +2826,14 @@ install_amazon_linux_ami_deps() { packages="PyYAML m2crypto python-crypto python-msgpack python-zmq python-ordereddict python-jinja2 python-requests" if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" packages="${packages} python-pip" fi yum -y install ${packages} --enablerepo=${_EPEL_REPO} || return 1 if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" pip-python install "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi @@ -3811,7 +3810,7 @@ __gentoo_post_dep() { __gentoo_config_protection if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then - check_pip_allowed "You need to allow pip based installations(-P) in order to install apache-libcloud" + check_pip_allowed "You need to allow pip based installations (-P) in order to install apache-libcloud" __emerge -v 'dev-python/pip' pip install -U "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" fi From 3e7023a62050f0d0ac77bb8ef0726a95f93d0a74 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Wed, 9 Apr 2014 13:51:25 +0100 Subject: [PATCH 64/72] Fix parameter not set --- bootstrap-salt.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d748e04..e6693c1 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -1536,7 +1536,7 @@ install_ubuntu_deps() { else check_pip_allowed "You need to allow pip based installations (-P) in order to install the python package 'requests'" __apt_get_install_noinput python-pip - __PIP_PACKAGES="${__PIP_PACKAGES} requests" + __PIP_PACKAGES="requests" pip install requests fi @@ -1545,7 +1545,7 @@ install_ubuntu_deps() { if [ $_INSTALL_CLOUD -eq $BS_TRUE ]; then check_pip_allowed "You need to allow pip based installations (-P) in order to install 'apache-libcloud'" - if [ "x${__PIP_PACKAGES}" == "x" ]; then + if [ "x${__PIP_PACKAGES}" = "x" ]; then __apt_get_install_noinput python-pip fi __PIP_PACKAGES="${__PIP_PACKAGES} 'apache-libcloud>=$_LIBCLOUD_MIN_VERSION'" From acccf33a739eaf18aa67a0d80b530d648f4a81d3 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 13 Apr 2014 15:08:20 +0100 Subject: [PATCH 65/72] Store testsuite logs in a file --- tests/runtests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/runtests.py b/tests/runtests.py index 9c4dfa7..7125195 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -68,7 +68,8 @@ def main(): parser = BootstrapSuiteParser( TEST_DIR, xml_output_dir=XML_OUTPUT_DIR, - html_output_dir=HTML_OUTPUT_DIR + html_output_dir=HTML_OUTPUT_DIR, + tests_logfile=os.path.join(tempfile.gettempdir(), 'bootstrap-runtests.log') ) options, _ = parser.parse_args() From dd33bf3a1f836ffce7487ad163bf22136f6aff31 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 14 Apr 2014 13:36:23 +0100 Subject: [PATCH 66/72] Log the process output --- tests/bootstrap/ext/nb_popen.py | 238 ++++++++++++++++++++++++++++++++ tests/bootstrap/unittesting.py | 21 ++- 2 files changed, 256 insertions(+), 3 deletions(-) create mode 100644 tests/bootstrap/ext/nb_popen.py diff --git a/tests/bootstrap/ext/nb_popen.py b/tests/bootstrap/ext/nb_popen.py new file mode 100644 index 0000000..6b32585 --- /dev/null +++ b/tests/bootstrap/ext/nb_popen.py @@ -0,0 +1,238 @@ +# -*- coding: utf-8 -*- +''' + :codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)` + :copyright: © 2013 by the SaltStack Team, see AUTHORS for more details. + :license: Apache 2.0, see LICENSE for more details. + + + salt.utils.nb_popen + ~~~~~~~~~~~~~~~~~~~ + + Non blocking subprocess Popen. + + This functionality has been adapted to work on windows following the recipe + found on: + + http://code.activestate.com/recipes/440554/ +''' + +# Import python libs +import os +import sys +import time +import errno +import select +import logging +import tempfile +import subprocess + +if subprocess.mswindows: + from win32file import ReadFile, WriteFile + from win32pipe import PeekNamedPipe + import msvcrt +else: + import fcntl + +log = logging.getLogger(__name__) + + +class NonBlockingPopen(subprocess.Popen): + + #_stdin_logger_name_ = 'salt.utils.nb_popen.STDIN.PID-{pid}' + _stdout_logger_name_ = 'salt.utils.nb_popen.STDOUT.PID-{pid}' + _stderr_logger_name_ = 'salt.utils.nb_popen.STDERR.PID-{pid}' + + def __init__(self, *args, **kwargs): + self.stream_stds = kwargs.pop('stream_stds', False) + + # Half a megabyte in memory is more than enough to start writing to + # a temporary file. + self.max_size_in_mem = kwargs.pop('max_size_in_mem', 512000) + + # Let's configure the std{in, out,err} logging handler names + #self._stdin_logger_name_ = kwargs.pop( + # 'stdin_logger_name', self._stdin_logger_name_ + #) + self._stdout_logger_name_ = kwargs.pop( + 'stdout_logger_name', self._stdout_logger_name_ + ) + self._stderr_logger_name_ = kwargs.pop( + 'stderr_logger_name', self._stderr_logger_name_ + ) + + stderr = kwargs.get('stderr', None) + + super(NonBlockingPopen, self).__init__(*args, **kwargs) + + #self._stdin_logger = logging.getLogger( + # self._stdin_logger_name_.format(pid=self.pid) + #) + + self.stdout_buff = tempfile.SpooledTemporaryFile(self.max_size_in_mem) + self._stdout_logger = logging.getLogger( + self._stdout_logger_name_.format(pid=self.pid) + ) + + if stderr is subprocess.STDOUT: + self.stderr_buff = self.stdout_buff + self._stderr_logger = self._stdout_logger + else: + self.stderr_buff = tempfile.SpooledTemporaryFile( + self.max_size_in_mem + ) + self._stderr_logger = logging.getLogger( + self._stderr_logger_name_.format(pid=self.pid) + ) + + self._stderr_logger = logging.getLogger( + self._stderr_logger_name_.format(pid=self.pid) + ) + + log.info( + 'Running command under pid {0}: {1!r}'.format(self.pid, *args) + ) + + def recv(self, maxsize=None): + return self._recv('stdout', maxsize) + + def recv_err(self, maxsize=None): + return self._recv('stderr', maxsize) + + def send_recv(self, input='', maxsize=None): + return self.send(input), self.recv(maxsize), self.recv_err(maxsize) + + def get_conn_maxsize(self, which, maxsize): + if maxsize is None: + maxsize = 1024 + elif maxsize < 1: + maxsize = 1 + return getattr(self, which), maxsize + + def _close(self, which): + getattr(self, which).close() + setattr(self, which, None) + + if subprocess.mswindows: + def send(self, input): + if not self.stdin: + return None + + try: + x = msvcrt.get_osfhandle(self.stdin.fileno()) + (errCode, written) = WriteFile(x, input) + #self._stdin_logger.debug(input.rstrip()) + except ValueError: + return self._close('stdin') + except (subprocess.pywintypes.error, Exception) as why: + if why[0] in (109, errno.ESHUTDOWN): + return self._close('stdin') + raise + + return written + + def _recv(self, which, maxsize): + conn, maxsize = self.get_conn_maxsize(which, maxsize) + if conn is None: + return None + + try: + x = msvcrt.get_osfhandle(conn.fileno()) + (read, nAvail, nMessage) = PeekNamedPipe(x, 0) + if maxsize < nAvail: + nAvail = maxsize + if nAvail > 0: + (errCode, read) = ReadFile(x, nAvail, None) + except ValueError: + return self._close(which) + except (subprocess.pywintypes.error, Exception) as why: + if why[0] in (109, errno.ESHUTDOWN): + return self._close(which) + raise + + getattr(self, '{0}_buff'.format(which)).write(read) + getattr(self, '_{0}_logger'.format(which)).debug(read.rstrip()) + if self.stream_stds: + getattr(sys, which).write(read) + + if self.universal_newlines: + read = self._translate_newlines(read) + return read + + else: + + def send(self, input): + if not self.stdin: + return None + + if not select.select([], [self.stdin], [], 0)[1]: + return 0 + + try: + written = os.write(self.stdin.fileno(), input) + #self._stdin_logger.debug(input.rstrip()) + except OSError as why: + if why[0] == errno.EPIPE: # broken pipe + return self._close('stdin') + raise + + return written + + def _recv(self, which, maxsize): + conn, maxsize = self.get_conn_maxsize(which, maxsize) + if conn is None: + return None + + flags = fcntl.fcntl(conn, fcntl.F_GETFL) + if not conn.closed: + fcntl.fcntl(conn, fcntl.F_SETFL, flags | os.O_NONBLOCK) + + try: + if not select.select([conn], [], [], 0)[0]: + return '' + + buff = conn.read(maxsize) + if not buff: + return self._close(which) + + if self.universal_newlines: + buff = self._translate_newlines(buff) + + getattr(self, '{0}_buff'.format(which)).write(buff) + getattr(self, '_{0}_logger'.format(which)).debug(buff.rstrip()) + if self.stream_stds: + getattr(sys, which).write(buff) + + return buff + finally: + if not conn.closed: + fcntl.fcntl(conn, fcntl.F_SETFL, flags) + + def poll_and_read_until_finish(self): + silent_iterations = 0 + while self.poll() is None: + if self.stdout is not None: + silent_iterations = 0 + self.recv() + + if self.stderr is not None: + silent_iterations = 0 + self.recv_err() + + silent_iterations += 1 + + if silent_iterations > 100: + silent_iterations = 0 + (stdoutdata, stderrdata) = self.communicate() + if stdoutdata: + log.debug(stdoutdata) + if stderrdata: + log.error(stderrdata) + time.sleep(0.01) + + def communicate(self, input=None): + super(NonBlockingPopen, self).communicate(input) + self.stdout_buff.flush() + self.stdout_buff.seek(0) + self.stderr_buff.flush() + self.stderr_buff.seek(0) + return self.stdout_buff.read(), self.stderr_buff.read() diff --git a/tests/bootstrap/unittesting.py b/tests/bootstrap/unittesting.py index 4204057..7027bc9 100644 --- a/tests/bootstrap/unittesting.py +++ b/tests/bootstrap/unittesting.py @@ -15,10 +15,11 @@ import os import sys import fcntl import signal +import logging import subprocess from datetime import datetime, timedelta -# Import salt bootstrap libs +# Import salt testing libs from salttesting import * from salttesting.ext.os_data import GRAINS @@ -30,8 +31,12 @@ BOOTSTRAP_SCRIPT_PATH = os.path.join(PARENT_DIR, 'bootstrap-salt.sh') class NonBlockingPopen(subprocess.Popen): + _stdout_logger_name_ = 'salt-bootstrap.NonBlockingPopen.STDOUT.PID-{pid}' + _stderr_logger_name_ = 'salt-bootstrap.NonBlockingPopen.STDERR.PID-{pid}' + def __init__(self, *args, **kwargs): self.stream_stds = kwargs.pop('stream_stds', False) + self._stdout_logger = self._stderr_logger = None super(NonBlockingPopen, self).__init__(*args, **kwargs) if self.stdout is not None and self.stream_stds: fod = self.stdout.fileno() @@ -46,12 +51,22 @@ class NonBlockingPopen(subprocess.Popen): self.ebuff = '' def poll(self): + if self._stdout_logger is None: + self._stdout_logger = logging.getLogger( + self._stdout_logger_name_.format(pid=self.pid) + ) + if self._stderr_logger is None: + self._stderr_logger = logging.getLogger( + self._stderr_logger_name_.format(pid=self.pid) + ) poll = super(NonBlockingPopen, self).poll() if self.stdout is not None and self.stream_stds: try: obuff = self.stdout.read() self.obuff += obuff + if obuff.strip(): + self._stdout_logger.info(obuff.strip()) sys.stdout.write(obuff) except IOError, err: if err.errno not in (11, 35): @@ -62,6 +77,8 @@ class NonBlockingPopen(subprocess.Popen): try: ebuff = self.stderr.read() self.ebuff += ebuff + if ebuff.strip(): + self._stderr_logger.info(ebuff.strip()) sys.stderr.write(ebuff) except IOError, err: if err.errno not in (11, 35): @@ -103,8 +120,6 @@ class BootstrapTestCase(TestCase): cmd = [script] + list(args) - outbuff = errbuff = '' - popen_kwargs = { 'cwd': cwd, 'shell': True, From 267fb30898b8ec265926683130814fd2d27fd3b2 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Mon, 14 Apr 2014 14:14:54 +0100 Subject: [PATCH 67/72] Stream output and force a timeout --- tests/bootstrap/test_lint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/bootstrap/test_lint.py b/tests/bootstrap/test_lint.py index adc233b..a05d0ca 100644 --- a/tests/bootstrap/test_lint.py +++ b/tests/bootstrap/test_lint.py @@ -22,6 +22,8 @@ class LintTestCase(BootstrapTestCase): 0, self.run_script( script=os.path.join(EXT_DIR, 'checkbashisms'), - args=('-pxfn', BOOTSTRAP_SCRIPT_PATH) + args=('-pxfn', BOOTSTRAP_SCRIPT_PATH), + timeout=120, + stream_stds=True ) ) From a22911cb3692701db1028b32d7e3496031685b7a Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 15 Apr 2014 09:58:26 +0100 Subject: [PATCH 68/72] Install `chkconfig` in CentOS bootstraps. Fixes #375. This happens with minimal ISO's --- bootstrap-salt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index e6693c1..703c82a 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -2279,7 +2279,7 @@ install_centos_stable_deps() { yum -y update || return 1 fi - packages="yum-utils" + packages="yum-utils chkconfig" if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then packages="${packages} python26-PyYAML python26-m2crypto m2crypto python26 python26-requests" From a721b8b83f57a253aa165cfd45dcef311c1891a1 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 15 Apr 2014 10:00:06 +0100 Subject: [PATCH 69/72] Update changes log --- ChangeLog | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9348706..f654790 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,7 +6,9 @@ Version 2014.XX.XX: * Install the python 'requests' package which is now a hard dependency in Salt. * When installing from a user defined repository add the official one as a remote and fetch its tags for proper versioning. - * Distro Support Addded: + * Distro Support Fixed: + * CentOS minimal ISO's didn't install `chkconfig` + * Distro Support Added: * Oracle Linux * Scientific Linux From b72bbbc2ea929d91d062df2369afd4bda7d11679 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 15 Apr 2014 10:01:41 +0100 Subject: [PATCH 70/72] It's the netinstall ISO's not the minimal ones --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f654790..76c6253 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,7 @@ Version 2014.XX.XX: * When installing from a user defined repository add the official one as a remote and fetch its tags for proper versioning. * Distro Support Fixed: - * CentOS minimal ISO's didn't install `chkconfig` + * CentOS netinstall ISO's don't install `chkconfig` * Distro Support Added: * Oracle Linux * Scientific Linux From 447d6aab4f7b4e19a71f58345b6ef5bdd23c12af Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 15 Apr 2014 23:45:28 +0100 Subject: [PATCH 71/72] Support Oracle Linux detection before UPDATE 3 Refs #338 --- bootstrap-salt.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 703c82a..fbf9583 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -664,6 +664,9 @@ __gather_linux_system_info() { elif [ "${DISTRO_NAME}" = "SUSE LINUX" ]; then # lsb_release -si returns "SUSE LINUX" on SLES 11 SP3 DISTRO_NAME="suse" + elif [ "${DISTRO_NAME}" = "EnterpriseEnterpriseServer" ]; then + # This the Oracle Linux Enterprise ID before ORACLE LINUX 5 UPDATE 3 + DISTRO_NAME="Oracle Linux" fi rv=$(lsb_release -sr) [ "${rv}x" != "x" ] && DISTRO_VERSION=$(__parse_version_string "$rv") From e47b6ae827709a6f6991399fe73b35a6e909ddc5 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Tue, 15 Apr 2014 23:46:51 +0100 Subject: [PATCH 72/72] Prepare for the 2014.04.16 release --- ChangeLog | 2 +- bootstrap-salt.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76c6253..b1f1642 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Version 2014.XX.XX: +Version 2014.04:16 * Fixed a bug for RHEL 6 based distributions where yum-utils was not getting installed. * Added minor version check for RHEL 6 optional channel. * Added quotes around "apache-libcloud>=$_LIBCLOUD_MIN_VERSION" for proper version requirements diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index fbf9583..c11b96e 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -17,7 +17,7 @@ # CREATED: 10/15/2012 09:49:37 PM WEST #====================================================================================================================== set -o nounset # Treat unset variables as an error -__ScriptVersion="2014.03.10-1" +__ScriptVersion="2014.04.16" __ScriptName="bootstrap-salt.sh" #======================================================================================================================