Merge pull request #1177 from rallytime/merge-stable

[stable] Merge forward from develop to stable
This commit is contained in:
Nicole Thomas 2017-12-13 13:14:33 -05:00 committed by GitHub
commit e6aa6d7830
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 898 additions and 949 deletions

View file

@ -13,6 +13,7 @@ Alec Koumjian akoumjian akoumjian@gmail.com
Alex Van't Hof alexvh
Alexander Krasnukhin themalkolm the.malkolm@gmail.com
Alexey dmitrievav
Ali Rizvi-Santiago arizvisa
amendlik amendlik
Andrew Dean ndrwdn ndrwdn@gmail.com
Andy Boff caelor github@plek.me.uk
@ -30,6 +31,7 @@ bruce-one bruce-one
Вячеслав Спиридонов sp1r
C. R. Oldham cro cr@saltstack.com
Cam camereonsparr
Charles McLaughlin cmclaughlin
Megan Wilhite Ch3LL megan.wilhite@gmail.com
Chris Rebert cvrebert chris.rebert@hulu.com
Chris Buechler cbuechler cmb@pfsense.org
@ -139,5 +141,6 @@ Vladimir Kozhukalov kozhukalov
Whit Morriss whitmo whit@nocoast.us
Wolodja Wentland babilen w@babilen5.org
Wout wfhg
Yann Masson ymasson
Yushi Nakai nyushi
========================== ===================== ============================

273
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,273 @@
# Contributing Guidelines
## License Notice
The Salt Bootstrap project is open and encouraging to code contributions. Please be
advised that all code contributions will be licensed under the Apache 2.0 License.
We cannot accept contributions that already hold a License other than Apache 2.0
without explicit exception.
## Reporting Issues
The Salt Bootstrap issue tracker is used for feature requests and bug reports.
### Bugs
A bug is a *demonstrable problem* that is caused by the code in the repository.
Please read the following guidelines before you
[file an issue](https://github.com/saltstack/salt-bootstrap/issues/new).
1. **Use the GitHub issue search** -- check if the issue has
already been reported. If it has been, please comment on the existing issue.
2. **Check if the issue has been fixed** -- If you found a possible problem, or bug,
please try to bootstrap using the bootstrap scirpt from the develop branch. The
issue you are having might have already been fixed and it's just not yet included
in the stable release.
```
curl -o bootstrap-salt.sh -L https://raw.githubusercontent.com/saltstack/salt-bootstrap/develop/bootstrap-salt.sh
sudo sh bootstrap-salt.sh git develop
```
3. **Isolate the demonstrable problem** -- make sure that the
code in the project's repository is *definitely* responsible for the issue.
4. **Include a reproducible example** -- Provide the steps which
led you to the problem.
Please try to be as detailed as possible in your report. What is your
environment? What steps will reproduce the issue? What operating system? What
would you expect to be the outcome? All these details will help people to
assess and fix any potential bugs.
**Including the version and system information will always help,** such as:
- Output of `salt --versions-report`
- Output of `bootstrap-salt.sh -v`
- System type
- Cloud/VM provider as appropriate
Valid bugs will worked on as quickly as resources can be reasonably allocated.
### Features
Feature additions and requests are welcomed. When requesting a feature it will
be placed under the `Feature` label.
If a new feature is desired, the fastest way to get it into Salt Bootstrap is
to contribute the code. Before starting on a new feature, an issue should be
filed for it. The one requesting the feature will be able to then discuss the
feature with the Salt Bootstrap maintainers and discover the best way to get
the feature included into the bootstrap script and if the feature makes sense.
It is possible that the desired feature has already been completed.
Look for it in the [README](https://github.com/saltstack/salt-bootstrap/blob/develop/README.rst)
or exploring the wide list of options detailed at the top of the script. These
options are also available by running the `-h` help option for the script. It
is also common that the problem which would be solved by the new feature can be
easily solved another way, which is a great reason to ask first.
## Fixing Issues
Fixes for issues are very welcome!
Once you've fixed the issue you have in hand, create a
[pull request](https://help.github.com/articles/creating-a-pull-request/).
Salt Bootstrap maintainers will review your fix. If everything is OK and all
tests pass, you fix will be merged into Salt Bootstrap's code.
### Branches
There are two main branches in the Salt Bootstrap repository:
- develop
- stable
All fixes and features should be submitted to the `develop` branch. The `stable`
branch only contains released versions of the bootstrap script.
## Pull Requests
The Salt Bootstrap repo has several pull request checks that must pass before
a bug fix or feature implementation can be merged in.
### PR Tests
There are several Jenkins jobs that run on each Pull Request. Most of these are
CI jobs that set up different steps, such as setting up the job, cloning the
repo from the PR, etc.
#### Lint Check
The pull request test that matters the most, and the contributor is directly
responsible for fixing, is the Lint check. This check *must* be passing before
the contribution can be merged into the codebase.
If the lint check has failed on your pull request, you can view the errors by
clicking `Details` in the test run output. Then, click the `Violations` link on
the left side. There you will see a list of files that have errors. By clicking
on the file, you will see `!` icons on the affected line. Hovering over the `!`
icons will explain what the issue is.
To run the lint tests locally before submitting a pull request, use the
`tests/runtests.py` file. The `-L` option runs the lint check:
```
python tests/runtests.py -L
```
### GPG Verification
SaltStack has enabled [GPG Probot](https://probot.github.io/apps/gpg/) to
enforce GPG signatures for all commits included in a Pull Request.
In order for the GPG verification status check to pass, *every* contributor in
the pull request must:
- Set up a GPG key on local machine
- Sign all commits in the pull request with key
- Link key with GitHub account
This applies to all commits in the pull request.
GitHub hosts a number of
[help articles](https://help.github.com/articles/signing-commits-with-gpg/) for
creating a GPG key, using the GPG key with `git` locally, and linking the GPG
key to your GitHub account. Once these steps are completed, the commit signing
verification will look like the example in GitHub's
[GPG Signature Verification feature announcement](https://github.com/blog/2144-gpg-signature-verification).
## Release Cadence
There is no defined release schedule for the bootstrap script at this time.
Typically, SaltStack's release team determines when it would be good to release
a new stable version.
Timing the release usually involves an analysis of the following:
- Updates for major feature releases in [Salt](https://github.com/saltstack/salt)
- Support for new versions of major operating systems
- Types of fixes submitted to `develop` since the last release
- Fixes needed for inclusion in an upcoming version of [Salt](https://github.com/saltstack/salt)
- Length of time since the last bootstrap release
## Adding Support for Other Operating Systems
The following operating systems are detected, but Salt and its dependency
installation functions are not developed yet:
- BSD:
- NetBSD
- Linux:
- Slackware
- SunOS:
- OpenIndiana
- Oracle Solaris
- OmniOS (Illumos)
In order to install Salt for a distribution, you need to define the following:
1. To Install Dependencies, which is required, one of:
```
install_<distro>_<major_version>_<install_type>_deps
install_<distro>_<major_version>_<minor_version>_<install_type>_deps
install_<distro>_<major_version>_deps
install_<distro>_<major_version>_<minor_version>_deps
install_<distro>_<install_type>_deps
install_<distro>_deps
```
2. Optionally, define a minion configuration function, which will be called if the
``-c`` option is passed. One of:
```
config_<distro>_<major_version>_<install_type>_salt
config_<distro>_<major_version>_<minor_version>_<install_type>_salt
config_<distro>_<major_version>_salt
config_<distro>_<major_version>_<minor_version>_salt
config_<distro>_<install_type>_salt
config_<distro>_salt
config_salt (THIS ONE IS ALREADY DEFINED AS THE DEFAULT)
```
3. Optionally, define a Salt master pre-seed function, which will be called if the
``-k`` (pre-seed master keys) option is passed. One of:
```
preseed_<distro>_<major_version>_<install_type>_master
preseed_<distro>_<major_version>_<minor_version>_<install_type>_master
preseed_<distro>_<major_version>_master
preseed_<distro>_<major_version>_<minor_version>_master
preseed_<distro>_<install_type>_master
preseed_<distro>_master
preseed_master (THIS ONE IS ALREADY DEFINED AS THE DEFAULT)
```
4. To install salt, which, of course, is required, one of:
```
install_<distro>_<major_version>_<install_type>
install_<distro>_<major_version>_<minor_version>_<install_type>
install_<distro>_<install_type>
```
5. Optionally, define a post install function, one of:
```
install_<distro>_<major_version>_<install_type>_post
install_<distro>_<major_version>_<minor_version>_<install_type>_post
install_<distro>_<major_version>_post
install_<distro>_<major_version>_<minor_version>_post
install_<distro>_<install_type>_post
install_<distro>_post
```
6. Optionally, define a start daemons function, one of:
```
install_<distro>_<major_version>_<install_type>_restart_daemons
install_<distro>_<major_version>_<minor_version>_<install_type>_restart_daemons
install_<distro>_<major_version>_restart_daemons
install_<distro>_<major_version>_<minor_version>_restart_daemons
install_<distro>_<install_type>_restart_daemons
install_<distro>_restart_daemons
```
**NOTE**
The start daemons function should be able to restart any daemons which are running, or
start if they're not running.
7. Optionally, define a daemons running function, one of:
```
daemons_running_<distro>_<major_version>_<install_type>
daemons_running_<distro>_<major_version>_<minor_version>_<install_type>
daemons_running_<distro>_<major_version>
daemons_running_<distro>_<major_version>_<minor_version>
daemons_running_<distro>_<install_type>
daemons_running_<distro>
daemons_running (THIS ONE IS ALREADY DEFINED AS THE DEFAULT)
```
8. Optionally, check enabled Services:
```
install_<distro>_<major_version>_<install_type>_check_services
install_<distro>_<major_version>_<minor_version>_<install_type>_check_services
install_<distro>_<major_version>_check_services
install_<distro>_<major_version>_<minor_version>_check_services
install_<distro>_<install_type>_check_services
install_<distro>_check_services
```
**NOTE**
The bootstrapping script must be plain POSIX `sh` only, **not** `bash` or another shell script.
By design, the targeting for each operating system and version is very specific. Assumptions of
supported versions or variants should not be made, to avoid failed or broken installations.

View file

@ -1,3 +1,23 @@
Version 2017.12.13:
* Use HTTPS URL for OpenSuse's saltstack repo (gdm85) #1174
* Respect disable repos (-r) option on OpenBSD (eradman) #1171
* Fix #1168 : -b option causes error (vutny) #1170
* Fix fatal error with using the -b option. (arizvisa) #1169
* Devuan support (ymasson) #1165
* Fix yum repo on AWS Linux (cmclaughlin) #1164
* Use suse repo to install packages, rather than defining them (rallytime) #1157
* Remove patch-level-1 specific code for SLES installs (rallytime) #1156
* priority sort fedora-release (toanju) #1153
* Declare EOL for SUSE Linux Enterprise Server releases (vutny) #1150
* Fix #1142: allow git install on Raspbian 9 (vutny) #1146
* Follow symlinks when parsing distro release files (vutny) #1145
* fedora: use dnf-utils for F26 and above (toanju) #1144
* Declare EOL for openSUSE LEAP 42.1 (vutny) #1143
* Fix #1137: import GPG key through an HTTP(S) proxy (vutny) #1139
* Fix #1138: git install on Debian/Ubuntu various arches (vutny) #1141
* Declare EOL for openSUSE releases earlier and including 13.X (vutny) #1136
* Update Fedora support: 24 is EOL (rallytime) #1134
Version 2017.08.17:
* Add new authors (rallytime) #1130
* README: Fix typo and Table of Contents for Debian section (vutny) #1129

View file

@ -1,6 +1,6 @@
Salt Bootstrap - Generic Salt Bootstrap Script
Copyright 2012-2016 Salt Stack (saltstack.org)
Copyright 2012-2017 Salt Stack (saltstack.org)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

View file

@ -13,16 +13,11 @@ the `Salt`_ installation process is handled by this shell script ``bootstrap-sal
script runs through a series of checks to determine operating system type and version to then
install the `Salt`_ binaries using the appropriate methods.
.. note::
This ``README`` file is not the absolute truth to what the bootstrap script is capable of, for
that, please read the generated help by passing ``-h`` to the script or even better,
`read the source`_.
**In case you found a bug, please read** `I Found a Bug`_ **first before submitting a new issue.**
The examples there show how to get the latest development version of the bootstrap script. Chances
are high that your issue was already fixed.
**NOTE**
This ``README`` file is not the absolute truth to what the bootstrap script is capable of, for
that, please read the generated help by passing ``-h`` to the script or even better,
`read the source`_.
Bootstrap
=========
@ -32,11 +27,17 @@ of the downloaded ``bootstrap-salt.sh`` file.
The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
- 2017.08.17: ``909b4d35696b9867b34b22ef4b60edbc5a0e9f8d1ed8d05f922acb79a02e46e3``
- 2017.05.24: ``8c42c2e5ad3d4384ddc557da5c214ba3e40c056ca1b758d14a392c1364650e89``
If you're looking for the *one-liner* to install Salt, please scroll to the bottom and use the
instructions for `Installing via an Insecure One-Liner`_.
Contributing
------------
The Salt Bootstrap project is open and encouraging to code contributions. Please review the
`Contributing Guidelines`_ for information on filing issues, fixing bugs, and submitting features.
Examples
--------
@ -44,11 +45,11 @@ Examples
The Salt Bootstrap script has a wide variety of options that can be passed as
well as several ways of obtaining the bootstrap script itself.
.. note::
**NOTE**
These examples below show how to bootstrap Salt directly from GitHub or other Git repository.
Run the script without any parameters to get latest stable Salt packages for your system from
`SaltStack's corporate repository`_. See first example in the `Install using wget`_ section.
These examples below show how to bootstrap Salt directly from GitHub or other Git repository.
Run the script without any parameters to get latest stable Salt packages for your system from
`SaltStack's corporate repository`_. See first example in the `Install using wget`_ section.
Install using curl
@ -108,10 +109,10 @@ Installing a specific version from git using ``wget``:
wget -O bootstrap-salt.sh https://bootstrap.saltstack.com
sudo sh bootstrap-salt.sh -P git v2016.11.5
.. note::
**NOTE**
On the above example we added `-P` which will allow PIP packages to be installed if required but
it's not a necessary flag for Git based bootstraps.
On the above example we added `-P` which will allow PIP packages to be installed if required but
it's not a necessary flag for Git based bootstraps.
Install using Python
@ -163,14 +164,14 @@ Or link them to the right place:
Installing via an Insecure One-Liner
------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following examples illustrate how to install Salt via a one-liner.
.. note::
**NOTE**
Warning! These methods do not involve a verification step and assume that the delivered file is
trustworthy.
Warning! These methods do not involve a verification step and assume that the delivered file is
trustworthy.
Any of the example above which use two-lines can be made to run in a single-line
configuration with minor modifications.
@ -205,7 +206,7 @@ listed on the official supported operating systems document, the level of suppor
Since Salt is written in Python, the packages available from `SaltStack's corporate repository`_
are CPU architecture independent and could be installed on any hardware supported by Linux kernel.
However, SaltStack does package Salt's binary dependencies only for ``x86_64`` (``amd64``) and
``AArch32`` (``armhf``), which is limited for Debian/Raspbian 8 platforms.
``AArch32`` (``armhf``). The latter is available only for Debian/Raspbian 8 platforms.
It is recommended to use ``git`` bootstrap mode as described above to install Salt on other
architectures, such as ``x86`` (``i386``), ``AArch64`` (``arm64``) or ``ARM EABI`` (``armel``).
@ -216,12 +217,11 @@ You also may need to disable repository configuration and allow ``pip`` installa
sudo sh bootstrap-salt.sh -r -P git develop
.. note::
**NOTE**
Bootstrap may fail to install Salt on the cutting-edge version of distributions with frequent
release cycles such as: Amazon Linux, Fedora, openSUSE Tumbleweed, or Ubuntu non-LTS. Check the
versions from the list below. Also, see the `Unsupported Distro`_ and
`Adding Support for Other Operating Systems`_ sections.
Bootstrap may fail to install Salt on the cutting-edge version of distributions with frequent
release cycles such as: Amazon Linux, Fedora, openSUSE Tumbleweed, or Ubuntu non-LTS. Check the
versions from the list below. Also, see the `Unsupported Distro`_ section.
Debian and derivatives
@ -229,9 +229,10 @@ Debian and derivatives
- Cumulus Linux 2/3
- Debian GNU/Linux 7/8/9
- Devuan GNU/Linux 1/2
- Linux Mint Debian Edition 1 (based on Debian 8)
- Kali Linux 1.0 (based on Debian 7)
- Raspbian 8 (``armhf``)
- Raspbian 8 (``armhf`` packages) and 9 (using ``git`` installation mode only)
Debian Best Effort Support: Testing Release
*******************************************
@ -252,7 +253,7 @@ Red Hat family
- Amazon Linux 2012.3 and later
- CentOS 6/7
- Cloud Linux 6/7
- Fedora 24/25
- Fedora 25/26
- Oracle Linux 6/7
- Red Hat Enterprise Linux 6/7
- Scientific Linux 6/7
@ -261,10 +262,9 @@ Red Hat family
SUSE family
~~~~~~~~~~~
- openSUSE 12/13
- openSUSE Leap 42
- openSUSE Leap 42.2/42.3
- openSUSE Tumbleweed 2015
- SUSE Linux Enterprise Server 11 SP1/11 SP2/11 SP3/12
- SUSE Linux Enterprise Server 11 SP4, 12 SP2
Ubuntu and derivatives
@ -306,7 +306,6 @@ UNIX systems
- SmartOS
Unsupported Distro
------------------
@ -318,211 +317,14 @@ Please run the following commands and report their output when creating a ticket
sudo find /etc/ -name \*-release -print -exec cat {} \;
command lsb_release -a
For information on how to add support for a currently unsupported distro, please refer to the
`Contributing Guidelines`_.
Adding Support for Other Operating Systems
------------------------------------------
The following operating systems are detected, but Salt and its dependencies installation functions
are not developed yet:
**BSD**:
- NetBSD
**Linux**:
- Slackware
**SunOS**
- OpenIndiana
- Oracle Solaris
- OmniOS (Illumos)
In order to install Salt for a distribution you need to define:
1. To Install Dependencies, which is required, one of:
.. code:: bash
install_<distro>_<major_version>_<install_type>_deps
install_<distro>_<major_version>_<minor_version>_<install_type>_deps
install_<distro>_<major_version>_deps
install_<distro>_<major_version>_<minor_version>_deps
install_<distro>_<install_type>_deps
install_<distro>_deps
2. Optionally, define a minion configuration function, which will be called if the
``-c`` option is passed. One of:
.. code:: bash
config_<distro>_<major_version>_<install_type>_salt
config_<distro>_<major_version>_<minor_version>_<install_type>_salt
config_<distro>_<major_version>_salt
config_<distro>_<major_version>_<minor_version>_salt
config_<distro>_<install_type>_salt
config_<distro>_salt
config_salt [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
3. Optionally, define a Salt master pre-seed function, which will be called if the
``-k`` (pre-seed master keys) option is passed. One of:
.. code:: bash
preseed_<distro>_<major_version>_<install_type>_master
preseed_<distro>_<major_version>_<minor_version>_<install_type>_master
preseed_<distro>_<major_version>_master
preseed_<distro>_<major_version>_<minor_version>_master
preseed_<distro>_<install_type>_master
preseed_<distro>_master
preseed_master [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
4. To install salt, which, of course, is required, one of:
.. code:: bash
install_<distro>_<major_version>_<install_type>
install_<distro>_<major_version>_<minor_version>_<install_type>
install_<distro>_<install_type>
5. Optionally, define a post install function, one of:
.. code:: bash
install_<distro>_<major_version>_<install_type>_post
install_<distro>_<major_version>_<minor_version>_<install_type>_post
install_<distro>_<major_version>_post
install_<distro>_<major_version>_<minor_version>_post
install_<distro>_<install_type>_post
install_<distro>_post
6. Optionally, define a start daemons function, one of:
.. code:: bash
install_<distro>_<major_version>_<install_type>_restart_daemons
install_<distro>_<major_version>_<minor_version>_<install_type>_restart_daemons
install_<distro>_<major_version>_restart_daemons
install_<distro>_<major_version>_<minor_version>_restart_daemons
install_<distro>_<install_type>_restart_daemons
install_<distro>_restart_daemons
.. admonition:: Attention!
The start daemons function should be able to restart any daemons which are running, or start if
they're not running.
7. Optionally, define a daemons running function, one of:
.. code:: bash
daemons_running_<distro>_<major_version>_<install_type>
daemons_running_<distro>_<major_version>_<minor_version>_<install_type>
daemons_running_<distro>_<major_version>
daemons_running_<distro>_<major_version>_<minor_version>
daemons_running_<distro>_<install_type>
daemons_running_<distro>
daemons_running [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
8. Optionally, check enabled Services:
.. code:: bash
install_<distro>_<major_version>_<install_type>_check_services
install_<distro>_<major_version>_<minor_version>_<install_type>_check_services
install_<distro>_<major_version>_check_services
install_<distro>_<major_version>_<minor_version>_check_services
install_<distro>_<install_type>_check_services
install_<distro>_check_services
----
Below is an example for Ubuntu Oneiric (the example may not be up to date with the script):
.. code:: bash
install_ubuntu_11_10_deps() {
apt-get update
apt-get -y install python-software-properties
add-apt-repository -y 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
add-apt-repository -y ppa:saltstack/salt
}
install_ubuntu_11_10_post() {
add-apt-repository -y --remove 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
}
install_ubuntu_stable() {
apt-get -y install salt-minion
}
install_ubuntu_restart_daemons() {
for fname in minion master syndic; do
# Skip if not meant to be installed
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
if [ -f /sbin/initctl ]; then
# We have upstart support
/sbin/initctl status salt-$fname > /dev/null 2>&1
if [ $? -eq 0 ]; then
# upstart knows about this service, let's stop and start it.
# We could restart but earlier versions of the upstart script
# did not support restart, so, it's safer this way
/sbin/initctl stop salt-$fname > /dev/null 2>&1
/sbin/initctl start salt-$fname > /dev/null 2>&1
[ $? -eq 0 ] && continue
# We failed to start the service, let's test the SysV code bellow
fi
fi
/etc/init.d/salt-$fname stop > /dev/null 2>&1
/etc/init.d/salt-$fname start
done
}
Since there is no ``install_ubuntu_11_10_stable()`` it defaults to the unspecified version script.
The bootstrapping script must be plain POSIX ``sh`` only, **not** ``bash`` or another shell script.
By design the targeting for each operating system and version is very specific. Assumptions of
supported versions or variants should not be made, to avoid failed or broken installations.
I Found a Bug
=============
If you found a possible problem, or bug, please try to bootstrap using the develop version. The
issue you are having might have already been fixed and it's just not yet included in the stable
version.
.. code:: console
curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com/develop
sudo sh bootstrap-salt.sh git develop
Or the insecure one liner:
.. code:: console
curl -L https://bootstrap.saltstack.com/develop | sudo sh -s -- git develop
If after trying this and the problem still occurs, please `file an issue`_.
Testing
-------
There are a couple of ways to test the bootstrap script. Running the script on a full-fledged
VM is one way. Other options include using Vagrant or Docker.
Testing in Vagrant
==================
@ -535,7 +337,6 @@ Ubuntu box. First, install Vagrant, then:
vagrant up
vagrant ssh
Running in Docker
=================
@ -562,15 +363,14 @@ And finally "enter" the running container and make Salt fully operational:
Salt is ready and working in the Docker container with Minion authenticated on Master.
.. note::
The ``Dockerfile`` here inherits Ubuntu 14.04 public image with Upstart configured as init system.
Consider it as an example or starting point of how to make your own Docker images with suitable
Salt components, custom configurations and even `pre-accepted Minion key`_ already installed.
**NOTE**
The ``Dockerfile`` here inherits Ubuntu 14.04 public image with Upstart configured as init system.
Consider it as an example or starting point of how to make your own Docker images with suitable
Salt components, custom configurations and even `pre-accepted Minion key`_ already installed.
.. _Contributing Guidelines: https://github.com/saltstack/salt-bootstrap/blob/develop/CONTRIBUTING.md
.. _Docker: https://www.docker.com/
.. _`file an issue`: https://github.com/saltstack/salt-bootstrap/issues/new
.. _`pre-accepted Minion key`: https://docs.saltstack.com/en/latest/topics/tutorials/preseed_key.html
.. _`read the source`: https://github.com/saltstack/salt-bootstrap/blob/develop/bootstrap-salt.sh
.. _`Salt`: https://saltstack.com/community/

View file

@ -18,7 +18,7 @@
#======================================================================================================================
set -o nounset # Treat unset variables as an error
__ScriptVersion="2017.08.17"
__ScriptVersion="2017.12.13"
__ScriptName="bootstrap-salt.sh"
__ScriptFullName="$0"
@ -710,10 +710,24 @@ else
SETUP_PY_INSTALL_ARGS=""
fi
# Handle the insecure flags
if [ "$_INSECURE_DL" -eq $BS_TRUE ]; then
_CURL_ARGS="${_CURL_ARGS} --insecure"
_FETCH_ARGS="${_FETCH_ARGS} --no-verify-peer"
_GPG_ARGS="${_GPG_ARGS} --keyserver-options no-check-cert"
_WGET_ARGS="${_WGET_ARGS} --no-check-certificate"
else
_GPG_ARGS="${_GPG_ARGS} --keyserver-options ca-cert-file=/etc/ssl/certs/ca-certificates.crt"
fi
# Export the http_proxy configuration to our current environment
if [ "${_HTTP_PROXY}" != "" ]; then
export http_proxy="$_HTTP_PROXY"
export https_proxy="$_HTTP_PROXY"
export http_proxy="${_HTTP_PROXY}"
export https_proxy="${_HTTP_PROXY}"
# Using "deprecated" option here, but that appears the only way to make it work.
# See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818802
# and https://bugs.launchpad.net/ubuntu/+source/gnupg2/+bug/1625848
_GPG_ARGS="${_GPG_ARGS},http-proxy=${_HTTP_PROXY}"
fi
# Work around for 'Docker + salt-bootstrap failure' https://github.com/saltstack/salt-bootstrap/issues/394
@ -737,15 +751,6 @@ if [ -d "${_VIRTUALENV_DIR}" ]; then
exit 1
fi
# Handle the insecure flags
if [ "$_INSECURE_DL" -eq $BS_TRUE ]; then
_CURL_ARGS="${_CURL_ARGS} --insecure"
_FETCH_ARGS="${_FETCH_ARGS} --no-verify-peer"
_GPG_ARGS="${_GPG_ARGS} --keyserver-options no-check-cert"
_WGET_ARGS="${_WGET_ARGS} --no-check-certificate"
else
_GPG_ARGS="${_GPG_ARGS} --keyserver-options ca-cert-file=/etc/ssl/certs/ca-certificates.crt"
fi
#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __fetch_url
@ -915,7 +920,7 @@ __sort_release_files() {
done
# Now let's sort by know files importance, max important goes last in the max_prio list
max_prio="redhat-release centos-release oracle-release"
max_prio="redhat-release centos-release oracle-release fedora-release"
for entry in $max_prio; do
if [ "$(echo "${primary_release_files}" | grep "$entry")" != "" ]; then
primary_release_files=$(echo "${primary_release_files}" | sed -e "s:\(.*\)\($entry\)\(.*\):\2 \1 \3:g")
@ -1001,7 +1006,6 @@ __gather_linux_system_info() {
echo redhat-release lsb-release
)"); do
[ -L "/etc/${rsource}" ] && continue # Don't follow symlinks
[ ! -f "/etc/${rsource}" ] && continue # Does not exist
n=$(echo "${rsource}" | sed -e 's/[_-]release$//' -e 's/[_-]version$//')
@ -1397,13 +1401,16 @@ __debian_derivatives_translation() {
# If the file does not exist, return
[ ! -f /etc/os-release ] && return
DEBIAN_DERIVATIVES="(cumulus_.+|kali|linuxmint|raspbian)"
DEBIAN_DERIVATIVES="(cumulus_.+|devuan|kali|linuxmint|raspbian)"
# Mappings
cumulus_2_debian_base="7.0"
cumulus_3_debian_base="8.0"
devuan_1_debian_base="8.0"
devuan_2_debian_base="9.0"
kali_1_debian_base="7.0"
linuxmint_1_debian_base="8.0"
raspbian_8_debian_base="8.0"
raspbian_9_debian_base="9.0"
# Translate Debian derivatives to their base Debian version
match=$(echo "$DISTRO_NAME_L" | egrep ${DEBIAN_DERIVATIVES})
@ -1414,6 +1421,10 @@ __debian_derivatives_translation() {
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
_debian_derivative="cumulus"
;;
devuan)
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
_debian_derivative="devuan"
;;
kali)
_major=$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')
_debian_derivative="kali"
@ -1428,12 +1439,13 @@ __debian_derivatives_translation() {
;;
esac
_debian_version=$(eval echo "\$${_debian_derivative}_${_major}_debian_base")
_debian_version=$(eval echo "\$${_debian_derivative}_${_major}_debian_base" 2>/dev/null)
if [ "$_debian_version" != "" ]; then
echodebug "Detected Debian $_debian_version derivative"
DISTRO_NAME_L="debian"
DISTRO_VERSION="$_debian_version"
DISTRO_MAJOR_VERSION="$(echo "$DISTRO_VERSION" | sed 's/^\([0-9]*\).*/\1/g')"
fi
fi
}
@ -1501,8 +1513,10 @@ __check_end_of_life_versions() {
opensuse)
# openSUSE versions not supported
#
# <= 12.1
if ([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$DISTRO_MINOR_VERSION" -eq 1 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 12 ]; then
# <= 13.X
# <= 42.1
if [ "$DISTRO_MAJOR_VERSION" -le 13 ] || \
([ "$DISTRO_MAJOR_VERSION" -eq 42 ] && [ "$DISTRO_MINOR_VERSION" -le 1 ]); then
echoerror "End of life distributions are not supported."
echoerror "Please consider upgrading to the next stable. See:"
echoerror " http://en.opensuse.org/Lifetime"
@ -1513,21 +1527,25 @@ __check_end_of_life_versions() {
suse)
# SuSE versions not supported
#
# < 11 SP2
# < 11 SP4
# < 12 SP2
SUSE_PATCHLEVEL=$(awk '/PATCHLEVEL/ {print $3}' /etc/SuSE-release )
if [ "${SUSE_PATCHLEVEL}" = "" ]; then
SUSE_PATCHLEVEL="00"
fi
if ([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$SUSE_PATCHLEVEL" -lt 02 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 11 ]; then
echoerror "Versions lower than SuSE 11 SP2 are not supported."
if [ "$DISTRO_MAJOR_VERSION" -lt 11 ] || \
([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$SUSE_PATCHLEVEL" -lt 04 ]) || \
([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$SUSE_PATCHLEVEL" -lt 02 ]); then
echoerror "Versions lower than SuSE 11 SP4 or 12 SP2 are not supported."
echoerror "Please consider upgrading to the next stable"
echoerror " https://www.suse.com/lifecycle/"
exit 1
fi
;;
fedora)
# Fedora lower than 24 are no longer supported
if [ "$DISTRO_MAJOR_VERSION" -lt 24 ]; then
# Fedora lower than 25 are no longer supported
if [ "$DISTRO_MAJOR_VERSION" -lt 25 ]; then
echoerror "End of life distributions are not supported."
echoerror "Please consider upgrading to the next stable. See:"
echoerror " https://fedoraproject.org/wiki/Releases"
@ -1729,18 +1747,6 @@ if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $_PIP_ALL -eq $BS_TRUE ]); then
exit 1
fi
# Starting from Debian 9 and Ubuntu 16.10, gnupg-curl has been renamed to gnupg1-curl.
GNUPG_CURL="gnupg-curl"
if [ "$DISTRO_NAME_L" = "debian" ]; then
if [ "$DISTRO_MAJOR_VERSION" -gt 8 ]; then
GNUPG_CURL="gnupg1-curl"
fi
elif [ "$DISTRO_NAME_L" = "ubuntu" ]; then
if [ "${DISTRO_VERSION}" = "16.10" ] || [ "$DISTRO_MAJOR_VERSION" -gt 16 ]; then
GNUPG_CURL="gnupg1-curl"
fi
fi
#--- FUNCTION -------------------------------------------------------------------------------------------------------
# NAME: __function_defined
@ -1786,8 +1792,6 @@ __apt_get_upgrade_noinput() {
__apt_key_fetch() {
url=$1
__apt_get_install_noinput ${GNUPG_CURL} || return 1
# shellcheck disable=SC2086
apt-key adv ${_GPG_ARGS} --fetch-keys "$url"; return $?
} # ---------- end of function __apt_key_fetch ----------
@ -2539,7 +2543,6 @@ __enable_universe_repository() {
}
__install_saltstack_ubuntu_repository() {
# Workaround for latest non-LTS ubuntu
if [ "$DISTRO_VERSION" = "16.10" ] || [ "$DISTRO_MAJOR_VERSION" -gt 16 ]; then
echowarn "Non-LTS Ubuntu detected, but stable packages requested. Trying packages from latest LTS release. You may experience problems."
@ -2550,15 +2553,27 @@ __install_saltstack_ubuntu_repository() {
UBUNTU_CODENAME=$DISTRO_CODENAME
fi
# SaltStack's stable Ubuntu repository:
SALTSTACK_UBUNTU_URL="${HTTP_VAL}://${_REPO_URL}/apt/ubuntu/${UBUNTU_VERSION}/${__REPO_ARCH}/${STABLE_REV}"
echo "deb $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > /etc/apt/sources.list.d/saltstack.list
__PACKAGES=''
# Install downloader backend for GPG keys fetching
if [ "$DISTRO_VERSION" = "16.10" ] || [ "$DISTRO_MAJOR_VERSION" -gt 16 ]; then
__PACKAGES="${__PACKAGES} gnupg2 dirmngr"
else
__PACKAGES="${__PACKAGES} gnupg-curl"
fi
# Make sure https transport is available
if [ "$HTTP_VAL" = "https" ] ; then
__apt_get_install_noinput apt-transport-https ca-certificates || return 1
__PACKAGES="${__PACKAGES} apt-transport-https ca-certificates"
fi
# shellcheck disable=SC2086,SC2090
__apt_get_install_noinput ${__PACKAGES} || return 1
# SaltStack's stable Ubuntu repository:
SALTSTACK_UBUNTU_URL="${HTTP_VAL}://${_REPO_URL}/apt/ubuntu/${UBUNTU_VERSION}/${__REPO_ARCH}/${STABLE_REV}"
echo "deb $SALTSTACK_UBUNTU_URL $UBUNTU_CODENAME main" > /etc/apt/sources.list.d/saltstack.list
__apt_key_fetch "$SALTSTACK_UBUNTU_URL/SALTSTACK-GPG-KEY.pub" || return 1
apt-get update
@ -2640,9 +2655,8 @@ install_ubuntu_stable_deps() {
__apt_get_upgrade_noinput || return 1
fi
__check_dpkg_architecture || return 1
if [ "$_DISABLE_REPOS" -eq "$BS_FALSE" ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
__check_dpkg_architecture || return 1
__install_saltstack_ubuntu_repository || return 1
fi
@ -2936,18 +2950,30 @@ __install_saltstack_debian_repository() {
DEBIAN_CODENAME="$DISTRO_CODENAME"
fi
__PACKAGES=''
# Install downloader backend for GPG keys fetching
if [ "$DISTRO_MAJOR_VERSION" -ge 9 ]; then
__PACKAGES="${__PACKAGES} gnupg2 dirmngr"
else
__PACKAGES="${__PACKAGES} gnupg-curl"
fi
# Make sure https transport is available
if [ "$HTTP_VAL" = "https" ] ; then
__PACKAGES="${__PACKAGES} apt-transport-https ca-certificates"
fi
# shellcheck disable=SC2086,SC2090
__apt_get_install_noinput ${__PACKAGES} || return 1
# amd64 is just a part of repository URI, 32-bit pkgs are hosted under the same location
SALTSTACK_DEBIAN_URL="${HTTP_VAL}://${_REPO_URL}/apt/debian/${DEBIAN_RELEASE}/${__REPO_ARCH}/${STABLE_REV}"
echo "deb $SALTSTACK_DEBIAN_URL $DEBIAN_CODENAME main" > "/etc/apt/sources.list.d/saltstack.list"
if [ "$HTTP_VAL" = "https" ] ; then
__apt_get_install_noinput apt-transport-https ca-certificates || return 1
fi
__apt_key_fetch "$SALTSTACK_DEBIAN_URL/SALTSTACK-GPG-KEY.pub" || return 1
apt-get update
}
install_debian_deps() {
@ -2970,23 +2996,17 @@ install_debian_deps() {
__apt_get_upgrade_noinput || return 1
fi
__check_dpkg_architecture || return 1
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
__PACKAGES='procps pciutils'
# YAML module is used for generating custom master/minion configs
__PACKAGES="${__PACKAGES} python-yaml"
# Debian 9 needs the dirmgr package in order to import the GPG key later
if [ "$DISTRO_MAJOR_VERSION" -ge 9 ]; then
__PACKAGES="${__PACKAGES} dirmngr"
fi
# shellcheck disable=SC2086
__apt_get_install_noinput ${__PACKAGES} || return 1
if [ "$_DISABLE_REPOS" -eq "$BS_FALSE" ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
__check_dpkg_architecture || return 1
__install_saltstack_debian_repository || return 1
fi
@ -3318,7 +3338,13 @@ install_fedora_deps() {
__install_saltstack_copr_salt_repository || return 1
fi
__PACKAGES="yum-utils PyYAML libyaml python-crypto python-jinja2 python-zmq python2-msgpack python2-requests"
__PACKAGES="PyYAML libyaml python-crypto python-jinja2 python-zmq python2-msgpack python2-requests"
if [ "$DISTRO_MAJOR_VERSION" -lt 26 ]; then
__PACKAGES="${__PACKAGES} yum-utils"
else
__PACKAGES="${__PACKAGES} dnf-utils"
fi
# shellcheck disable=SC2086
dnf install -y ${__PACKAGES} || return 1
@ -4404,7 +4430,7 @@ install_amazon_linux_ami_deps() {
repo_rev="$(echo "${STABLE_REV}" | sed 's|.*\/||g')"
if echo "$repo_rev" | egrep -q '^(latest|2016\.11)$' || \
( echo "$repo_rev" | egrep -q '^[0-9]+$' && [ "$(echo "$repo_rev" | cut -c1-4)" -gt 2016 ] ); then
[ "$(echo "$repo_rev" | cut -c1-4)" -gt 2016 ]; then
_USEAWS=$BS_TRUE
pkg_append="python27"
fi
@ -5075,7 +5101,7 @@ install_freebsd_restart_daemons() {
__choose_openbsd_mirror() {
OPENBSD_REPO=''
MINTIME=''
MIRROR_LIST=$(ftp -w 15 -Vao - 'http://ftp.openbsd.org/cgi-bin/ftplist.cgi?dbversion=1' | awk '/^http/ {print $1}')
MIRROR_LIST=$(ftp -w 15 -Vao - 'https://ftp.openbsd.org/cgi-bin/ftplist.cgi?dbversion=1' | awk '/^http/ {print $1}')
for MIRROR in $MIRROR_LIST; do
MIRROR_HOST=$(echo "$MIRROR" | sed -e 's|.*//||' -e 's|+*/.*$||')
@ -5096,10 +5122,12 @@ __choose_openbsd_mirror() {
}
install_openbsd_deps() {
if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
__choose_openbsd_mirror || return 1
echoinfo "setting package repository to $OPENBSD_REPO with ping time of $MINTIME"
[ -n "$OPENBSD_REPO" ] || return 1
echo "${OPENBSD_REPO}" >>/etc/installurl || return 1
fi
if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
@ -5383,9 +5411,30 @@ install_smartos_restart_daemons() {
#
__ZYPPER_REQUIRES_REPLACE_FILES=-1
__set_suse_pkg_repo() {
# Set distro repo variable
if [ "${DISTRO_MAJOR_VERSION}" -gt 2015 ]; then
DISTRO_REPO="openSUSE_Tumbleweed"
elif [ "${DISTRO_MAJOR_VERSION}" -ge 42 ]; then
DISTRO_REPO="openSUSE_Leap_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
elif [ "${DISTRO_MAJOR_VERSION}" -lt 42 ]; then
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}_SP${SUSE_PATCHLEVEL}"
fi
if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then
suse_pkg_url_base="https://download.opensuse.org/repositories/systemsmanagement:/saltstack"
suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo"
else
suse_pkg_url_base="${HTTP_VAL}://repo.saltstack.com/opensuse"
suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack:products.repo"
fi
SUSE_PKG_URL="$suse_pkg_url_base/$suse_pkg_url_path"
}
__check_and_refresh_suse_pkg_repo() {
# Check to see if systemsmanagement_saltstack exists
__zypper repos | grep systemsmanagement_saltstack >/dev/null 2>&1
__zypper repos | grep -q systemsmanagement_saltstack
if [ $? -eq 1 ]; then
# zypper does not yet know anything about systemsmanagement_saltstack
@ -5393,16 +5442,6 @@ __check_and_refresh_suse_pkg_repo() {
fi
}
__set_suse_pkg_repo() {
suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo"
if [ "$_DOWNSTREAM_PKG_REPO" -eq $BS_TRUE ]; then
suse_pkg_url_base="http://download.opensuse.org/repositories/systemsmanagement:/saltstack"
else
suse_pkg_url_base="${HTTP_VAL}://repo.saltstack.com/opensuse"
fi
SUSE_PKG_URL="$suse_pkg_url_base/$suse_pkg_url_path"
}
__version_lte() {
if ! __check_command_exists python; then
zypper zypper --non-interactive install --replacefiles --auto-agree-with-licenses python || \
@ -5435,14 +5474,6 @@ __zypper_install() {
}
install_opensuse_stable_deps() {
if [ "${DISTRO_MAJOR_VERSION}" -gt 2015 ]; then
DISTRO_REPO="openSUSE_Tumbleweed"
elif [ "${DISTRO_MAJOR_VERSION}" -ge 42 ]; then
DISTRO_REPO="openSUSE_Leap_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
elif [ "${DISTRO_MAJOR_VERSION}" -lt 42 ]; then
DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
fi
if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
# Is the repository already known
__set_suse_pkg_repo
@ -5466,25 +5497,14 @@ install_opensuse_stable_deps() {
__zypper --gpg-auto-import-keys update || return 1
fi
# YAML module is used for generating custom master/minion configs
# requests is still used by many salt modules
# Salt needs python-zypp installed in order to use the zypper module
__PACKAGES="python-zypp"
__PACKAGES="${__PACKAGES} python python-Jinja2 python-M2Crypto python-PyYAML python-requests"
__PACKAGES="${__PACKAGES} python-msgpack-python python-pycrypto python-pyzmq python-xml"
if [ "$DISTRO_MAJOR_VERSION" -lt 13 ]; then
__PACKAGES="${__PACKAGES} libzmq3"
elif [ "$DISTRO_MAJOR_VERSION" -eq 13 ]; then
__PACKAGES="${__PACKAGES} libzmq3"
elif [ "$DISTRO_MAJOR_VERSION" -gt 13 ]; then
__PACKAGES="${__PACKAGES} libzmq5"
fi
__PACKAGES="python-PyYAML python-requests python-zypp"
# shellcheck disable=SC2086
__zypper_install ${__PACKAGES} || return 1
# Fix for OpenSUSE 13.2 and 2015.8 - gcc should not be required. Work around until package is fixed by SuSE
_EXTRA_PACKAGES="${_EXTRA_PACKAGES} gcc python-devel libgit2-devel"
if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
# shellcheck disable=SC2086
@ -5509,7 +5529,7 @@ install_opensuse_git_deps() {
__git_clone_and_checkout || return 1
__PACKAGES=""
__PACKAGES="libzmq5 python-Jinja2 python-msgpack-python python-pycrypto python-pyzmq python-xml"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
@ -5678,18 +5698,6 @@ install_opensuse_check_services() {
#
install_suse_12_stable_deps() {
SUSE_PATCHLEVEL=$(awk '/PATCHLEVEL/ {print $3}' /etc/SuSE-release )
if [ "${SUSE_PATCHLEVEL}" != "" ]; then
DISTRO_PATCHLEVEL="_SP${SUSE_PATCHLEVEL}"
fi
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}"
# SLES 12 repo name does not use a patch level so PATCHLEVEL will need to be updated with SP1
#DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}"
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}"
if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
# Is the repository already known
__set_suse_pkg_repo
@ -5703,18 +5711,10 @@ install_suse_12_stable_deps() {
__zypper --gpg-auto-import-keys update || return 1
fi
# YAML module is used for generating custom master/minion configs
# requests is still used by many salt modules
# Salt needs python-zypp installed in order to use the zypper module
__PACKAGES="python-zypp"
# shellcheck disable=SC2089
__PACKAGES="${__PACKAGES} libzmq5 python python-Jinja2 python-msgpack-python"
__PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests"
if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then
__check_pip_allowed
echowarn "PyYaml will be installed using pip"
else
__PACKAGES="${__PACKAGES} python-PyYAML"
fi
__PACKAGES="python-PyYAML python-requests python-zypp"
if [ "$_INSTALL_CLOUD" -eq $BS_TRUE ]; then
__PACKAGES="${__PACKAGES} python-apache-libcloud"
@ -5723,41 +5723,6 @@ install_suse_12_stable_deps() {
# shellcheck disable=SC2086,SC2090
__zypper_install ${__PACKAGES} || return 1
if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then
# There's no python-PyYaml in SP1, let's install it using pip
pip install PyYaml || return 1
fi
# PIP based installs need to copy configuration files "by hand".
if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then
# Let's trigger config_salt()
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
# Let's set the configuration directory to /tmp
_TEMP_CONFIG_DIR="/tmp"
CONFIG_SALT_FUNC="config_salt"
for fname in api master minion syndic; do
# Skip salt-api since there is no example config for it in the Salt git repo
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
# Syndic uses the same configuration file as the master
[ $fname = "syndic" ] && fname=master
# Let's download, since they were not provided, the default configuration files
if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \
"https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
fi
done
fi
fi
if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
# shellcheck disable=SC2086
@ -5777,6 +5742,9 @@ install_suse_12_git_deps() {
__git_clone_and_checkout || return 1
__PACKAGES=""
# shellcheck disable=SC2089
__PACKAGES="${__PACKAGES} libzmq3 python-Jinja2 python-msgpack-python python-pycrypto"
__PACKAGES="${__PACKAGES} python-pyzmq python-xml"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
@ -5803,14 +5771,7 @@ install_suse_12_git_deps() {
}
install_suse_12_stable() {
if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then
install_opensuse_stable || return 1
else
# USE_SETUPTOOLS=1 To work around
# error: option --single-version-externally-managed not recognized
USE_SETUPTOOLS=1 pip install salt || return 1
fi
return 0
}
@ -5820,34 +5781,7 @@ install_suse_12_git() {
}
install_suse_12_stable_post() {
if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then
install_opensuse_stable_post || return 1
else
for fname in api master minion syndic; do
# Skip if not meant to be installed
[ $fname = "api" ] && \
([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /bin/systemctl ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \
-o "/usr/lib/systemd/system/salt-$fname.service" || return 1
fi
# Skip salt-api since the service should be opt-in and not necessarily started on boot
[ $fname = "api" ] && continue
if [ -f /bin/systemctl ]; then
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
sleep 0.1
systemctl daemon-reload
fi
done
fi
return 0
}
@ -5872,16 +5806,6 @@ install_suse_12_restart_daemons() {
#
install_suse_11_stable_deps() {
SUSE_PATCHLEVEL=$(awk '/PATCHLEVEL/ {print $3}' /etc/SuSE-release )
if [ "${SUSE_PATCHLEVEL}" != "" ]; then
if [ "${SUSE_PATCHLEVEL}" != "4" ]; then
echowarn "Salt packages for SLE 11 are only build for SP4."
echowarn "Attempting to install SP4 packages on SP${SUSE_PATCHLEVEL}."
fi
DISTRO_PATCHLEVEL="_SP4"
fi
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}"
if [ $_DISABLE_REPOS -eq $BS_FALSE ]; then
# Is the repository already known
__set_suse_pkg_repo
@ -5895,57 +5819,12 @@ install_suse_11_stable_deps() {
__zypper --gpg-auto-import-keys update || return 1
fi
# Salt needs python-zypp installed in order to use the zypper module
__PACKAGES="python-zypp"
# shellcheck disable=SC2089
__PACKAGES="${__PACKAGES} libzmq5 python python-Jinja2 python-msgpack-python"
__PACKAGES="${__PACKAGES} python-pycrypto python-pyzmq python-pip python-xml python-requests"
if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then
__check_pip_allowed
echowarn "PyYaml will be installed using pip"
else
__PACKAGES="${__PACKAGES} python-PyYAML"
fi
# YAML module is used for generating custom master/minion configs
__PACKAGES="python-PyYAML"
# shellcheck disable=SC2086,SC2090
__zypper_install ${__PACKAGES} || return 1
if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then
# There's no python-PyYaml in SP1, let's install it using pip
pip install PyYaml || return 1
fi
# PIP based installs need to copy configuration files "by hand".
if [ "$SUSE_PATCHLEVEL" -eq 1 ]; then
# Let's trigger config_salt()
if [ "$_TEMP_CONFIG_DIR" = "null" ]; then
# Let's set the configuration directory to /tmp
_TEMP_CONFIG_DIR="/tmp"
CONFIG_SALT_FUNC="config_salt"
for fname in api master minion syndic; do
# Skip salt-api since there is no example config for it in the Salt git repo
[ $fname = "api" ] && continue
# Skip if not meant to be installed
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
# Syndic uses the same configuration file as the master
[ $fname = "syndic" ] && fname=master
# Let's download, since they were not provided, the default configuration files
if [ ! -f "$_SALT_ETC_DIR/$fname" ] && [ ! -f "$_TEMP_CONFIG_DIR/$fname" ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -s -o "$_TEMP_CONFIG_DIR/$fname" -L \
"https://raw.githubusercontent.com/saltstack/salt/develop/conf/$fname" || return 1
fi
done
fi
fi
if [ "${_EXTRA_PACKAGES}" != "" ]; then
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
# shellcheck disable=SC2086
@ -5965,6 +5844,9 @@ install_suse_11_git_deps() {
__git_clone_and_checkout || return 1
__PACKAGES=""
# shellcheck disable=SC2089
__PACKAGES="${__PACKAGES} libzmq4 python-Jinja2 python-msgpack-python python-pycrypto"
__PACKAGES="${__PACKAGES} python-pyzmq python-xml python-zypp"
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/requirements/base.txt" ]; then
# We're on the develop branch, install whichever tornado is on the requirements file
@ -5991,13 +5873,7 @@ install_suse_11_git_deps() {
}
install_suse_11_stable() {
if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then
install_opensuse_stable || return 1
else
# USE_SETUPTOOLS=1 To work around
# error: option --single-version-externally-managed not recognized
USE_SETUPTOOLS=1 pip install salt || return 1
fi
return 0
}
@ -6007,32 +5883,7 @@ install_suse_11_git() {
}
install_suse_11_stable_post() {
if [ "$SUSE_PATCHLEVEL" -gt 1 ]; then
install_opensuse_stable_post || return 1
else
for fname in api master minion syndic; do
# Skip if not meant to be installed
[ $fname = "api" ] && \
([ "$_INSTALL_MASTER" -eq $BS_FALSE ] || ! __check_command_exists "salt-${fname}") && continue
[ $fname = "master" ] && [ "$_INSTALL_MASTER" -eq $BS_FALSE ] && continue
[ $fname = "minion" ] && [ "$_INSTALL_MINION" -eq $BS_FALSE ] && continue
[ $fname = "syndic" ] && [ "$_INSTALL_SYNDIC" -eq $BS_FALSE ] && continue
if [ -f /bin/systemctl ]; then
# shellcheck disable=SC2086
curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service" \
-o "/lib/systemd/system/salt-$fname.service" || return 1
continue
fi
# shellcheck disable=SC2086
curl $_CURL_ARGS -L "https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname" \
-o "/etc/init.d/salt-$fname" || return 1
chmod +x "/etc/init.d/salt-$fname"
done
fi
return 0
}
@ -6050,6 +5901,8 @@ install_suse_11_restart_daemons() {
#
# End of SUSE Enterprise 11
#
#######################################################################################################################
#######################################################################################################################
#
# SUSE Enterprise General Functions
@ -6078,7 +5931,7 @@ install_suse_check_services() {
}
#
# SUSE Enterprise General Functions
# End of SUSE Enterprise General Functions
#
#######################################################################################################################
@ -6698,7 +6551,7 @@ for FUNC_NAME in $(__strip_duplicates "$CHECK_SERVICES_FUNC_NAMES"); do
done
echodebug "CHECK_SERVICES_FUNC=${CHECK_SERVICES_FUNC}"
if [ "$DEPS_INSTALL_FUNC" = "null" ]; then
if [ ${_NO_DEPS} -eq $BS_FALSE ] && [ "$DEPS_INSTALL_FUNC" = "null" ]; then
echoerror "No dependencies installation function found. Exiting..."
exit 1
fi
@ -6709,7 +6562,7 @@ if [ "$INSTALL_FUNC" = "null" ]; then
fi
# Install dependencies
if [ "$_CONFIG_ONLY" -eq $BS_FALSE ]; then
if [ ${_NO_DEPS} -eq $BS_FALSE ] && [ $_CONFIG_ONLY -eq $BS_FALSE ]; then
# Only execute function is not in config mode only
echoinfo "Running ${DEPS_INSTALL_FUNC}()"
$DEPS_INSTALL_FUNC
@ -6725,7 +6578,7 @@ if [ "$_CUSTOM_MASTER_CONFIG" != "null" ] || [ "$_CUSTOM_MINION_CONFIG" != "null
_TEMP_CONFIG_DIR="$_SALT_ETC_DIR"
fi
if [ "$_CONFIG_ONLY" -eq $BS_TRUE ]; then
if [ ${_NO_DEPS} -eq $BS_FALSE ] && [ $_CONFIG_ONLY -eq $BS_TRUE ]; then
# Execute function to satisfy dependencies for configuration step
echoinfo "Running ${DEPS_INSTALL_FUNC}()"
$DEPS_INSTALL_FUNC