mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-17 10:10:25 +00:00
Compare commits
40 commits
v2024.11.2
...
develop
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dd49d607b9 | ||
![]() |
b5c92f7a28 | ||
![]() |
420dc293c6 | ||
![]() |
4498c20596 | ||
![]() |
911349a8d3 | ||
![]() |
fba522c464 | ||
![]() |
bb988c99d6 | ||
![]() |
b626403ace | ||
![]() |
b58596dec3 | ||
![]() |
a2b422512d | ||
![]() |
82faed1938 | ||
![]() |
2058991403 | ||
![]() |
db07164315 | ||
![]() |
e85ff18bbc | ||
![]() |
73475d2505 | ||
![]() |
1040775f56 | ||
![]() |
316e65a979 | ||
![]() |
0075aa9902 | ||
![]() |
651d50aa05 | ||
![]() |
f47986ffd5 | ||
![]() |
dc01eea317 | ||
![]() |
d4cc7c1184 | ||
![]() |
a3971ee993 | ||
![]() |
b6683d5e5e | ||
![]() |
9d69e8a49d | ||
![]() |
a0285f3e6e | ||
![]() |
852a98fce4 | ||
![]() |
ac14d1d0fe | ||
![]() |
fa5ae443bc | ||
![]() |
a4c84236d8 | ||
![]() |
e5c03a53aa | ||
![]() |
54243fea9c | ||
![]() |
0bd577de50 | ||
![]() |
04c959b723 | ||
![]() |
644dfd1c57 | ||
![]() |
1b98100152 | ||
![]() |
e4b43b099b | ||
![]() |
c4fdafaef3 | ||
![]() |
bbaa32a888 | ||
![]() |
699ade0c04 |
12 changed files with 693 additions and 334 deletions
59
.github/workflows/ci.yml
vendored
59
.github/workflows/ci.yml
vendored
|
@ -114,22 +114,6 @@ jobs:
|
|||
|
||||
|
||||
|
||||
macos-12:
|
||||
name: macOS 12
|
||||
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
|
||||
uses: ./.github/workflows/test-macos.yml
|
||||
needs:
|
||||
- lint
|
||||
- generate-actions-workflow
|
||||
with:
|
||||
distro-slug: macos-12
|
||||
display-name: macOS 12
|
||||
container-slug: macos-12
|
||||
timeout: 20
|
||||
runs-on: macos-12
|
||||
instances: '["stable-3006", "stable-3006-8", "stable-3007", "stable-3007-1", "latest"]'
|
||||
|
||||
|
||||
macos-13:
|
||||
name: macOS 13
|
||||
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
|
||||
|
@ -180,6 +164,36 @@ jobs:
|
|||
|
||||
|
||||
|
||||
amazonlinux-2023:
|
||||
name: Amazon 2023
|
||||
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
|
||||
uses: ./.github/workflows/test-linux.yml
|
||||
needs:
|
||||
- lint
|
||||
- generate-actions-workflow
|
||||
with:
|
||||
distro-slug: amazonlinux-2023
|
||||
display-name: Amazon 2023
|
||||
container-slug: amazonlinux-2023
|
||||
timeout: 20
|
||||
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
|
||||
|
||||
|
||||
debian-11:
|
||||
name: Debian 11
|
||||
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
|
||||
uses: ./.github/workflows/test-linux.yml
|
||||
needs:
|
||||
- lint
|
||||
- generate-actions-workflow
|
||||
with:
|
||||
distro-slug: debian-11
|
||||
display-name: Debian 11
|
||||
container-slug: debian-11
|
||||
timeout: 20
|
||||
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
|
||||
|
||||
|
||||
debian-12:
|
||||
name: Debian 12
|
||||
if: github.event_name == 'push' || needs.collect-changed-files.outputs.run-tests == 'true'
|
||||
|
@ -190,7 +204,7 @@ jobs:
|
|||
with:
|
||||
distro-slug: debian-12
|
||||
display-name: Debian 12
|
||||
container-slug: systemd-debian-12
|
||||
container-slug: debian-12
|
||||
timeout: 20
|
||||
instances: '["stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'
|
||||
|
||||
|
@ -205,7 +219,7 @@ jobs:
|
|||
with:
|
||||
distro-slug: photon-5
|
||||
display-name: Photon OS 5
|
||||
container-slug: systemd-photon-5
|
||||
container-slug: photon-5
|
||||
timeout: 20
|
||||
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
|
||||
|
||||
|
@ -220,7 +234,7 @@ jobs:
|
|||
with:
|
||||
distro-slug: rockylinux-8
|
||||
display-name: Rocky Linux 8
|
||||
container-slug: systemd-rockylinux-8
|
||||
container-slug: rockylinux-8
|
||||
timeout: 20
|
||||
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
|
||||
|
||||
|
@ -235,7 +249,7 @@ jobs:
|
|||
with:
|
||||
distro-slug: rockylinux-9
|
||||
display-name: Rocky Linux 9
|
||||
container-slug: systemd-rockylinux-9
|
||||
container-slug: rockylinux-9
|
||||
timeout: 20
|
||||
instances: '["stable-3006", "onedir-3006", "stable-3006-8", "stable-3007", "onedir-3007", "stable-3007-1", "latest", "default"]'
|
||||
|
||||
|
@ -250,7 +264,7 @@ jobs:
|
|||
with:
|
||||
distro-slug: ubuntu-2204
|
||||
display-name: Ubuntu 22.04
|
||||
container-slug: systemd-ubuntu-22.04
|
||||
container-slug: ubuntu-22.04
|
||||
timeout: 20
|
||||
instances: '["stable-3006", "git-3006", "onedir-3006", "stable-3006-8", "stable-3007", "git-3007", "onedir-3007", "stable-3007-1", "git-master", "latest", "default"]'
|
||||
|
||||
|
@ -263,10 +277,11 @@ jobs:
|
|||
needs:
|
||||
- lint
|
||||
- generate-actions-workflow
|
||||
- macos-12
|
||||
- macos-13
|
||||
- macos-14
|
||||
- windows-2022
|
||||
- amazonlinux-2023
|
||||
- debian-11
|
||||
- debian-12
|
||||
- photon-5
|
||||
- rockylinux-8
|
||||
|
|
50
.github/workflows/templates/generate.py
vendored
50
.github/workflows/templates/generate.py
vendored
|
@ -6,17 +6,15 @@ import pathlib
|
|||
|
||||
os.chdir(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
# only test against current containers with systemd
|
||||
# will add these when they become available with systemd
|
||||
# "amazonlinux-2",
|
||||
# "amazonlinux-2023",
|
||||
# "debian-11",
|
||||
# "debian-13",
|
||||
# "fedora-40",
|
||||
# "photon-4",
|
||||
# "ubuntu-2004",
|
||||
# "ubuntu-2404",
|
||||
LINUX_DISTROS = [
|
||||
"amazonlinux-2023",
|
||||
"debian-11",
|
||||
"debian-12",
|
||||
"photon-5",
|
||||
"rockylinux-8",
|
||||
|
@ -29,22 +27,19 @@ WINDOWS = [
|
|||
]
|
||||
|
||||
OSX = [
|
||||
"macos-12",
|
||||
"macos-13",
|
||||
"macos-14",
|
||||
]
|
||||
|
||||
# only test against current containers with systemd
|
||||
# will add these when they become available with systemd
|
||||
# "amazonlinux-2",
|
||||
# "amazonlinux-2023",
|
||||
# "debian-11",
|
||||
# "debian-13",
|
||||
# "fedora-40",
|
||||
# "photon-4",
|
||||
# "ubuntu-2004",
|
||||
# "ubuntu-2404",
|
||||
STABLE_DISTROS = [
|
||||
"amazonlinux-2023",
|
||||
"debian-11",
|
||||
"debian-12",
|
||||
"photon-5",
|
||||
"rockylinux-8",
|
||||
|
@ -52,17 +47,15 @@ STABLE_DISTROS = [
|
|||
"ubuntu-2204",
|
||||
]
|
||||
|
||||
# only test against current containers with systemd
|
||||
# will add these when they become available with systemd
|
||||
# "amazonlinux-2",
|
||||
# "amazonlinux-2023",
|
||||
# "debian-11",
|
||||
# "debian-13",
|
||||
# "fedora-40",
|
||||
# "photon-4",
|
||||
# "ubuntu-2004",
|
||||
# "ubuntu-2404",
|
||||
ONEDIR_DISTROS = [
|
||||
"amazonlinux-2023",
|
||||
"debian-11",
|
||||
"debian-12",
|
||||
"photon-5",
|
||||
"rockylinux-8",
|
||||
|
@ -70,8 +63,6 @@ ONEDIR_DISTROS = [
|
|||
"ubuntu-2204",
|
||||
]
|
||||
|
||||
# only test against current containers with systemd
|
||||
# will add these when they become available with systemd
|
||||
# "amazonlinux-2",
|
||||
# "amazonlinux-2023",
|
||||
# "photon-4",
|
||||
|
@ -102,6 +93,7 @@ BLACKLIST_GIT_3006 = [
|
|||
"amazonlinux-2023",
|
||||
"debian-11",
|
||||
"debian-12",
|
||||
"debian-13",
|
||||
"fedora-40",
|
||||
"photon-4",
|
||||
"photon-5",
|
||||
|
@ -210,27 +202,25 @@ DISTRO_DISPLAY_NAMES = {
|
|||
"ubuntu-2004": "Ubuntu 20.04",
|
||||
"ubuntu-2204": "Ubuntu 22.04",
|
||||
"ubuntu-2404": "Ubuntu 24.04",
|
||||
"macos-12": "macOS 12",
|
||||
"macos-13": "macOS 13",
|
||||
"macos-14": "macOS 14",
|
||||
"windows-2022": "Windows 2022",
|
||||
}
|
||||
|
||||
CONTAINER_SLUG_NAMES = {
|
||||
"amazonlinux-2": "systemd-amazonlinux-2",
|
||||
"amazonlinux-2023": "systemd-amazonlinux-2023",
|
||||
"debian-11": "systemd-debian-11",
|
||||
"debian-12": "systemd-debian-12",
|
||||
"debian-13": "systemd-debian-13",
|
||||
"fedora-40": "systemd-fedora-40",
|
||||
"photon-4": "systemd-photon-4",
|
||||
"photon-5": "systemd-photon-5",
|
||||
"rockylinux-8": "systemd-rockylinux-8",
|
||||
"rockylinux-9": "systemd-rockylinux-9",
|
||||
"ubuntu-2004": "systemd-ubuntu-20.04",
|
||||
"ubuntu-2204": "systemd-ubuntu-22.04",
|
||||
"ubuntu-2404": "systemd-ubuntu-24.04",
|
||||
"macos-12": "macos-12",
|
||||
"amazonlinux-2": "amazonlinux-2",
|
||||
"amazonlinux-2023": "amazonlinux-2023",
|
||||
"debian-11": "debian-11",
|
||||
"debian-12": "debian-12",
|
||||
"debian-13": "debian-13",
|
||||
"fedora-40": "fedora-40",
|
||||
"photon-4": "photon-4",
|
||||
"photon-5": "photon-5",
|
||||
"rockylinux-8": "rockylinux-8",
|
||||
"rockylinux-9": "rockylinux-9",
|
||||
"ubuntu-2004": "ubuntu-20.04",
|
||||
"ubuntu-2204": "ubuntu-22.04",
|
||||
"ubuntu-2404": "ubuntu-24.04",
|
||||
"macos-13": "macos-13",
|
||||
"macos-14": "macOS 14",
|
||||
"windows-2022": "windows-2022",
|
||||
|
|
40
.github/workflows/test-linux.yml
vendored
40
.github/workflows/test-linux.yml
vendored
|
@ -32,10 +32,6 @@ jobs:
|
|||
Test:
|
||||
name: ${{ matrix.instance }}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }}
|
||||
options: --privileged
|
||||
|
||||
timeout-minutes: ${{ inputs.timeout }}
|
||||
strategy:
|
||||
max-parallel: 2
|
||||
|
@ -46,16 +42,6 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Python Dependencies with pip breakage
|
||||
if: ${{ ( inputs.distro-slug == 'debian-11' ) || ( inputs.distro-slug == 'debian-12' ) || ( inputs.distro-slug == 'debian-13' ) || ( inputs.distro-slug == 'ubuntu-2404' ) }}
|
||||
run: |
|
||||
python3 -m pip install --break-system-packages -r tests/requirements.txt
|
||||
|
||||
- name: Install Python Dependencies without pip breakage
|
||||
if: ${{ ( inputs.distro-slug != 'debian-11' ) && ( inputs.distro-slug != 'debian-12' ) && ( inputs.distro-slug != 'debian-13' ) && ( inputs.distro-slug != 'ubuntu-2404' ) }}
|
||||
run: |
|
||||
python3 -m pip install -r tests/requirements.txt
|
||||
|
||||
- name: Get Version
|
||||
run: |
|
||||
# We need to get the version here and make it an environment variable
|
||||
|
@ -65,17 +51,39 @@ jobs:
|
|||
vt_parm_ver=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}')
|
||||
echo "SaltVersion=$vt_parm_ver" >> $GITHUB_ENV
|
||||
|
||||
- name: "Pull container ${{ inputs.container-slug }}"
|
||||
run: |
|
||||
docker pull ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }}
|
||||
|
||||
- name: "Create container ${{ inputs.container-slug }}"
|
||||
run: |
|
||||
/usr/bin/docker create --name ${{ github.run_id }}_salt-test --workdir /_w/ --privileged -e "HOME=/github/home" -e GITHUB_ACTIONS=true -e CI=true -e $GITHUB_ENV -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work":"/__w" -v "/home/runner/work/_temp":"/__w/_temp" -v "/home/runner/work/_actions":"/__w/_actions" -v "/opt/hostedtoolcache":"/__t" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/salt-bootstrap/salt-bootstrap":"/_w/btstrap" --entrypoint "/usr/lib/systemd/systemd" ghcr.io/saltstack/salt-ci-containers/testing:${{ inputs.container-slug }} --systemd --unit rescue.target
|
||||
|
||||
- name: "Start container ${{ inputs.container-slug }}"
|
||||
run: |
|
||||
/usr/bin/docker start ${{ github.run_id }}_salt-test
|
||||
|
||||
- name: "Install Python Dependencies with pip breakage in container ${{ inputs.container-slug }}"
|
||||
if: ${{ ( inputs.distro-slug == 'debian-12' ) || ( inputs.distro-slug == 'debian-13' ) || ( inputs.distro-slug == 'ubuntu-2404' ) }}
|
||||
run: |
|
||||
docker exec ${{ github.run_id}}_salt-test python3 -m pip install --break-system-packages -r /_w/btstrap/tests/requirements.txt
|
||||
|
||||
- name: "Install Python Dependencies without pip breakage in container ${{ inputs.container-slug }}"
|
||||
if: ${{ ( inputs.distro-slug != 'debian-12' ) && ( inputs.distro-slug != 'debian-13' ) && ( inputs.distro-slug != 'ubuntu-2404' ) }}
|
||||
run: |
|
||||
docker exec ${{ github.run_id}}_salt-test python3 -m pip install -r /_w/btstrap/tests/requirements.txt
|
||||
|
||||
- name: Bootstrap Salt
|
||||
run: |
|
||||
# sed 1st - becomes space, 2nd - becomes dot
|
||||
bt_arg1=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $1}')
|
||||
bt_arg2=$(echo "${{ matrix.instance }}" | sed 's/-/ /' | sed 's/-/./' | awk -F ' ' '{print $2}')
|
||||
echo "bt parms ,$bt_parms, bt_arg1 ,$bt_arg1, bt_arg2 ,$bt_arg2,"
|
||||
sh -x ./bootstrap-salt.sh "$bt_arg1" "$bt_arg2"
|
||||
docker exec ${{ github.run_id}}_salt-test sh -x /_w/btstrap/bootstrap-salt.sh "$bt_arg1" "$bt_arg2"
|
||||
|
||||
- name: Test Bootstrap
|
||||
run: |
|
||||
pytest --cache-clear -v -s -ra --log-cli-level=debug tests/integration/
|
||||
docker exec ${{ github.run_id}}_salt-test pytest --cache-clear -v -s -ra --log-cli-level=debug /_w/btstrap/tests/integration/
|
||||
|
||||
- name: Set Exit Status
|
||||
if: always()
|
||||
|
|
4
.github/workflows/test-macos.yml
vendored
4
.github/workflows/test-macos.yml
vendored
|
@ -48,12 +48,12 @@ jobs:
|
|||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Python Dependencies with pip breakage
|
||||
if: ${{ ( inputs.distro-slug != 'macos-12' ) && ( inputs.distro-slug != 'macos-13' ) }}
|
||||
if: ${{ inputs.distro-slug != 'macos-13' }}
|
||||
run: |
|
||||
python3 -m pip install --break-system-packages -r tests/requirements.txt
|
||||
|
||||
- name: Install Python Dependencies without pip breakage
|
||||
if: ${{ ( inputs.distro-slug == 'macos-12' ) || ( inputs.distro-slug == 'macos-13' ) }}
|
||||
if: ${{ inputs.distro-slug == 'macos-13' }}
|
||||
run: |
|
||||
python3 -m pip install -r tests/requirements.txt
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ repos:
|
|||
- actionlint
|
||||
|
||||
- repo: https://github.com/jazzband/pip-tools
|
||||
rev: 7.3.0
|
||||
rev: 7.4.1
|
||||
hooks:
|
||||
- id: pip-compile
|
||||
files: ^requirements/release\.(in|txt)$
|
||||
|
@ -41,8 +41,10 @@ repos:
|
|||
rev: v3.15.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
name: Rewrite Code to be Py3.9+
|
||||
args: [--py39-plus]
|
||||
name: Rewrite Code to be Py3.6+
|
||||
args: [--py36-plus]
|
||||
## DGM name: Rewrite Code to be Py3.9+
|
||||
## DGM args: [--py39-plus]
|
||||
|
||||
- repo: https://github.com/asottile/reorder_python_imports
|
||||
rev: v3.12.0
|
||||
|
|
29
CHANGELOG.md
29
CHANGELOG.md
|
@ -1,3 +1,32 @@
|
|||
# v2025.02.24
|
||||
|
||||
## What's Changed
|
||||
|
||||
- Update requirements to address security issues by @twangboy in https://github.com/saltstack/salt-bootstrap/pull/2073
|
||||
- Use treeless clone to 'shallow' clone again. by @mrichar1 in https://github.com/saltstack/salt-bootstrap/pull/2022
|
||||
- Fix powershell instructions by @twangboy in https://github.com/saltstack/salt-bootstrap/pull/2074
|
||||
- Remove support for macos-12, as deprecated by github by @dmurphy18 in https://github.com/saltstack/salt-bootstrap/pull/2076
|
||||
|
||||
**Full Changelog**: https://github.com/saltstack/salt-bootstrap/compare/v2024.12.12...v2025.02.24
|
||||
|
||||
# v2024.12.12
|
||||
|
||||
## What's Changed
|
||||
|
||||
- Restrict use of dnf to Fedora only, otherwise use yum when dealing with RedHat family by @dmurphy18 in https://github.com/saltstack/salt-bootstrap/pull/2070
|
||||
- Updating container usage to that used in new Salt pipelines for CI/CD, fix Amazon Linux by @dmurphy18 in https://github.com/saltstack/salt-bootstrap/pull/2071
|
||||
|
||||
**Full Changelog**: https://github.com/saltstack/salt-bootstrap/compare/v2024.12.09...v2024.12.12
|
||||
|
||||
# v2024.12.09
|
||||
|
||||
## What's Changed
|
||||
|
||||
- Fix quickstart for Windows with new repo by @twangboy in https://github.com/saltstack/salt-bootstrap/pull/2065
|
||||
- Utilize salt-project packages with SUSE by @dmurphy18 in https://github.com/saltstack/salt-bootstrap/pull/2066
|
||||
|
||||
**Full Changelog**: https://github.com/saltstack/salt-bootstrap/compare/v2024.11.29...v2024.12.09
|
||||
|
||||
# v2024.11.29
|
||||
|
||||
## What's Changed
|
||||
|
|
|
@ -37,6 +37,10 @@ sum** of the downloaded ``bootstrap-salt.sh`` file.
|
|||
|
||||
The SHA256 sum of the ``bootstrap-salt.sh`` file, per release, is:
|
||||
|
||||
- 2025.02.24: ``a0e3a58fc6358a7c6f708ee4910229e72fbdab7161819514b0696146a2edb62d``
|
||||
- 2024.12.12: ``7cc91adfa5a15ff57d203dc2b79608c773efc639d4e9bf03861198903e11becd``
|
||||
- 2024.12.09: ``44f9405a6d9622ad8fa7c93e83a52e01ca328f27e4e9dea4a52268c6a22dbe6d``
|
||||
- 2024.11.29: ``0ac87384dee051aceded69704485a5de0e4a308551a462b10c262111b57acff0``
|
||||
- 2024.11.27: ``e972bd1ef01d09cd1d9294374ef974c9e3dd9a2aee37cf3859144585fd8bf1d0``
|
||||
- 2024.11.26: ``832c7a20b96e1df171d715323df9afff8a11aef42d15598c007f240bc89d723c``
|
||||
- 2024.11.21: ``ddf624c3a94d721da3f7629402a6c7ecc9dd96d13c1ead2a626314e97cee982a``
|
||||
|
@ -371,7 +375,7 @@ Using ``PowerShell`` to install latest stable version:
|
|||
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'
|
||||
Invoke-WebRequest -Uri https://github.com/saltstack/salt-bootstrap/releases/latest/download/bootstrap-salt.ps1 -OutFile "$env:TEMP\bootstrap-salt.ps1"
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser & "$env:TEMP\bootstrap-salt.ps1"
|
||||
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force; & "$env:TEMP\bootstrap-salt.ps1"
|
||||
|
||||
Display information about the install script parameters:
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ if ($help) {
|
|||
exit 0
|
||||
}
|
||||
|
||||
$__ScriptVersion = "2024.11.29"
|
||||
$__ScriptVersion = "2025.02.24"
|
||||
$ScriptName = $myInvocation.MyCommand.Name
|
||||
|
||||
# We'll check for the Version next, because it also has no requirements
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#======================================================================================================================
|
||||
set -o nounset # Treat unset variables as an error
|
||||
|
||||
__ScriptVersion="2024.11.29"
|
||||
__ScriptVersion="2025.02.24"
|
||||
__ScriptName="bootstrap-salt.sh"
|
||||
|
||||
__ScriptFullName="$0"
|
||||
|
@ -2161,21 +2161,19 @@ __git_clone_and_checkout() {
|
|||
fi
|
||||
|
||||
if [ "$__SHALLOW_CLONE" -eq $BS_TRUE ]; then
|
||||
# Let's try shallow cloning to speed up.
|
||||
# Test for "--single-branch" option introduced in git 1.7.10, the minimal version of git where the shallow
|
||||
# Let's try 'treeless' cloning to speed up. Treeless cloning omits trees and blobs ('files')
|
||||
# but includes metadata (commit history, tags, branches etc.
|
||||
# Test for "--filter" option introduced in git 2.19, the minimal version of git where the treeless
|
||||
# cloning we need actually works
|
||||
if [ "$(git clone 2>&1 | grep 'single-branch')" != "" ]; then
|
||||
# The "--single-branch" option is supported, attempt shallow cloning
|
||||
if [ "$(git clone 2>&1 | grep 'filter')" != "" ]; then
|
||||
# The "--filter" option is supported: attempt treeless cloning
|
||||
echoinfo "Attempting to shallow clone $GIT_REV_ADJ from Salt's repository ${_SALT_REPO_URL}"
|
||||
## Shallow cloning is resulting in the wrong version of Salt, even with a depth of 5
|
||||
## getting 3007.0+0na.246d066 when it should be 3007.1+410.g246d066457, disabling for now
|
||||
## if git clone --depth 1 --branch "$GIT_REV_ADJ" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"; then
|
||||
echodebug "git command, git clone --branch $GIT_REV_ADJ $_SALT_REPO_URL $__SALT_CHECKOUT_REPONAME"
|
||||
if git clone --branch "$GIT_REV_ADJ" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"; then
|
||||
echodebug "git command, git clone --filter=tree:0 --branch $GIT_REV_ADJ $_SALT_REPO_URL $__SALT_CHECKOUT_REPONAME"
|
||||
if git clone --filter=tree:0 --branch "$GIT_REV_ADJ" "$_SALT_REPO_URL" "$__SALT_CHECKOUT_REPONAME"; then
|
||||
# shellcheck disable=SC2164
|
||||
cd "${_SALT_GIT_CHECKOUT_DIR}"
|
||||
__SHALLOW_CLONE=$BS_TRUE
|
||||
echoinfo "shallow path (disabled shallow) git cloned $GIT_REV_ADJ, version $(python3 salt/version.py)"
|
||||
echoinfo "shallow path git cloned $GIT_REV_ADJ, version $(python3 salt/version.py)"
|
||||
else
|
||||
# Shallow clone above failed(missing upstream tags???), let's resume the old behaviour.
|
||||
echowarn "Failed to shallow clone."
|
||||
|
@ -3053,8 +3051,9 @@ __install_saltstack_ubuntu_onedir_repository() {
|
|||
echo "Pin: version $ONEDIR_REV.*" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin: version $ONEDIR_REV" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin: version $ONEDIR_REV_DOT" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
fi
|
||||
fi
|
||||
|
@ -3188,11 +3187,8 @@ install_ubuntu_git_deps() {
|
|||
__PACKAGES="${__PACKAGES} util-linux-extra"
|
||||
fi
|
||||
|
||||
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
|
||||
__PACKAGES="${__PACKAGES} procps pciutils"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
# Additionally install procps pciutils and sudo which allows for Docker bootstraps. See 366#issuecomment-39666813
|
||||
__PACKAGES="${__PACKAGES} procps pciutils sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__apt_get_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -3506,8 +3502,10 @@ __install_saltstack_debian_repository() {
|
|||
echo "Pin: version $STABLE_REV.*" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
|
||||
MINOR_VER_STRG="-$STABLE_REV_DOT"
|
||||
echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin: version $STABLE_REV" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin: version $STABLE_REV_DOT" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
fi
|
||||
fi
|
||||
|
@ -3549,8 +3547,9 @@ __install_saltstack_debian_onedir_repository() {
|
|||
echo "Pin: version $ONEDIR_REV.*" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "Package: salt-*" > /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin: version $ONEDIR_REV" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin: version $ONEDIR_REV_DOT" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
echo "Pin-Priority: 1001" >> /etc/apt/preferences.d/salt-pin-1001
|
||||
fi
|
||||
fi
|
||||
|
@ -3588,15 +3587,12 @@ install_debian_onedir_deps() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
|
||||
__PACKAGES='procps pciutils'
|
||||
# Additionally install procps, pciutils and sudo which allows for Docker bootstraps. See 366#issuecomment-39666813
|
||||
__PACKAGES='procps pciutils sudo'
|
||||
|
||||
# YAML module is used for generating custom master/minion configs
|
||||
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-yaml"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__apt_get_install_noinput ${__PACKAGES} || return 1
|
||||
|
||||
|
@ -3639,11 +3635,8 @@ install_debian_git_deps() {
|
|||
__PACKAGES="python${PY_PKG_VER}-dev python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc"
|
||||
echodebug "install_debian_git_deps() Installing ${__PACKAGES}"
|
||||
|
||||
# Additionally install procps and pciutils which allows for Docker bootstraps. See 366#issuecomment-39666813
|
||||
__PACKAGES="${__PACKAGES} procps pciutils"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
# Additionally install procps, pciutils and sudo which allows for Docker bootstraps. See 366#issuecomment-39666813
|
||||
__PACKAGES="${__PACKAGES} procps pciutils sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__apt_get_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -3895,9 +3888,10 @@ __install_saltstack_fedora_onedir_repository() {
|
|||
fi
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# using minor version
|
||||
echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}"
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
|
||||
# shellcheck disable=SC2129
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
|
@ -3942,14 +3936,11 @@ install_fedora_deps() {
|
|||
__PACKAGES="${__PACKAGES} dnf-utils libyaml procps-ng python${PY_PKG_VER}-crypto python${PY_PKG_VER}-jinja2"
|
||||
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-msgpack python${PY_PKG_VER}-requests python${PY_PKG_VER}-zmq"
|
||||
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-pip python${PY_PKG_VER}-m2crypto python${PY_PKG_VER}-pyyaml"
|
||||
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-systemd"
|
||||
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-systemd sudo"
|
||||
if [ "${_EXTRA_PACKAGES}" != "" ]; then
|
||||
echoinfo "Installing the following extra packages as requested: ${_EXTRA_PACKAGES}"
|
||||
fi
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__dnf_install_noinput ${__PACKAGES} ${_EXTRA_PACKAGES} || return 1
|
||||
|
||||
|
@ -3980,10 +3971,7 @@ install_fedora_git_deps() {
|
|||
# shellcheck disable=SC2119
|
||||
__git_clone_and_checkout || return 1
|
||||
|
||||
__PACKAGES="python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc gcc-c++"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc gcc-c++ sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__dnf_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -4112,10 +4100,7 @@ install_fedora_onedir_deps() {
|
|||
__install_saltstack_fedora_onedir_repository || return 1
|
||||
fi
|
||||
|
||||
__PACKAGES="dnf-utils chkconfig procps-ng"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="dnf-utils chkconfig procps-ng sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -4140,7 +4125,8 @@ install_fedora_onedir() {
|
|||
MINOR_VER_STRG=""
|
||||
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# Minor version Salt, need to add specific minor version
|
||||
MINOR_VER_STRG="-$STABLE_REV"
|
||||
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
|
||||
MINOR_VER_STRG="-$STABLE_REV_DOT"
|
||||
else
|
||||
MINOR_VER_STRG=""
|
||||
fi
|
||||
|
@ -4218,14 +4204,15 @@ __install_saltstack_rhel_onedir_repository() {
|
|||
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
|
||||
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
|
||||
# Enable the Salt 3007 STS repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-3007-sts
|
||||
yum config-manager --set-disable salt-repo-*
|
||||
yum config-manager --set-enabled salt-repo-3007-sts
|
||||
fi
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# using minor version
|
||||
echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}"
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
|
||||
# shellcheck disable=SC2129
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
|
@ -4236,11 +4223,11 @@ __install_saltstack_rhel_onedir_repository() {
|
|||
fi
|
||||
else
|
||||
# Enable the Salt LATEST repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-latest
|
||||
yum config-manager --set-disable salt-repo-*
|
||||
yum config-manager --set-enabled salt-repo-latest
|
||||
fi
|
||||
dnf clean expire-cache || return 1
|
||||
dnf makecache || return 1
|
||||
yum clean expire-cache || return 1
|
||||
yum makecache || return 1
|
||||
elif [ "$ONEDIR_REV" != "latest" ]; then
|
||||
echowarn "salt.repo already exists, ignoring salt version argument."
|
||||
echowarn "Use -F (forced overwrite) to install $ONEDIR_REV."
|
||||
|
@ -4273,10 +4260,7 @@ install_centos_stable_deps() {
|
|||
__install_saltstack_rhel_onedir_repository || return 1
|
||||
fi
|
||||
|
||||
__PACKAGES="yum-utils chkconfig procps-ng findutils"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -4297,7 +4281,8 @@ install_centos_stable() {
|
|||
MINOR_VER_STRG=""
|
||||
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# Minor version Salt, need to add specific minor version
|
||||
MINOR_VER_STRG="-$STABLE_REV"
|
||||
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
|
||||
MINOR_VER_STRG="-$STABLE_REV_DOT"
|
||||
else
|
||||
MINOR_VER_STRG=""
|
||||
fi
|
||||
|
@ -4321,9 +4306,6 @@ install_centos_stable() {
|
|||
__PACKAGES="${__PACKAGES} salt-api$MINOR_VER_STRG"
|
||||
fi
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
yum makecache || return 1
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -4402,10 +4384,7 @@ install_centos_git_deps() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="${__PACKAGES} python${PY_PKG_VER}-devel python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools gcc sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -4501,10 +4480,7 @@ install_centos_onedir_deps() {
|
|||
__install_saltstack_rhel_onedir_repository || return 1
|
||||
fi
|
||||
|
||||
__PACKAGES="yum-utils chkconfig procps-ng findutils"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -4525,7 +4501,8 @@ install_centos_onedir() {
|
|||
MINOR_VER_STRG=""
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# Minor version Salt, need to add specific minor version
|
||||
MINOR_VER_STRG="-$ONEDIR_REV"
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
MINOR_VER_STRG="-$ONEDIR_REV_DOT"
|
||||
else
|
||||
MINOR_VER_STRG=""
|
||||
fi
|
||||
|
@ -4550,8 +4527,8 @@ install_centos_onedir() {
|
|||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
dnf makecache || return 1
|
||||
dnf list salt-minion || return 1
|
||||
yum makecache || return 1
|
||||
yum list salt-minion || return 1
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
||||
return 0
|
||||
|
@ -5604,10 +5581,7 @@ install_amazon_linux_ami_2_git_deps() {
|
|||
# shellcheck disable=SC2119
|
||||
__git_clone_and_checkout || return 1
|
||||
|
||||
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -5629,10 +5603,7 @@ install_amazon_linux_ami_2_deps() {
|
|||
|
||||
# We need to install yum-utils before doing anything else when installing on
|
||||
# Amazon Linux ECS-optimized images. See issue #974.
|
||||
__PACKAGES="yum-utils"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="yum-utils sudo"
|
||||
|
||||
__yum_install_noinput ${__PACKAGES}
|
||||
|
||||
|
@ -5643,8 +5614,10 @@ install_amazon_linux_ami_2_deps() {
|
|||
|
||||
if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
|
||||
if [ ! -s "${YUM_REPO_FILE}" ]; then
|
||||
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
|
||||
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
|
||||
## Amazon Linux yum (v3) doesn't support config-manager
|
||||
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
|
||||
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
|
||||
# shellcheck disable=SC2129
|
||||
if [ "$STABLE_REV" != "latest" ]; then
|
||||
# 3006.x is default, and latest for 3006.x branch
|
||||
if [ "$(echo "$STABLE_REV" | grep -E '^(3006|3007)$')" != "" ]; then
|
||||
|
@ -5652,14 +5625,34 @@ install_amazon_linux_ami_2_deps() {
|
|||
REPO_REV_MAJOR=$(echo "$STABLE_REV" | cut -d '.' -f 1)
|
||||
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
|
||||
# Enable the Salt 3007 STS repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-3007-sts
|
||||
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
else
|
||||
# Salt 3006 repo
|
||||
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
fi
|
||||
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# using minor version
|
||||
echo "[salt-repo-${STABLE_REV}-lts]" > "${YUM_REPO_FILE}"
|
||||
# shellcheck disable=SC2129
|
||||
echo "name=Salt Repo for Salt v${STABLE_REV} LTS" >> "${YUM_REPO_FILE}"
|
||||
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
|
||||
echo "[salt-repo-${STABLE_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${STABLE_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
|
@ -5670,11 +5663,18 @@ install_amazon_linux_ami_2_deps() {
|
|||
fi
|
||||
else
|
||||
# Enable the Salt LATEST repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-latest
|
||||
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
fi
|
||||
dnf clean expire-cache || return 1
|
||||
dnf makecache || return 1
|
||||
yum clean expire-cache || return 1
|
||||
yum makecache || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -5693,10 +5693,7 @@ install_amazon_linux_ami_2_onedir_deps() {
|
|||
|
||||
# We need to install yum-utils before doing anything else when installing on
|
||||
# Amazon Linux ECS-optimized images. See issue #974.
|
||||
__PACKAGES="yum-utils"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
|
||||
|
||||
__yum_install_noinput ${__PACKAGES}
|
||||
|
||||
|
@ -5707,8 +5704,10 @@ install_amazon_linux_ami_2_onedir_deps() {
|
|||
|
||||
if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
|
||||
if [ ! -s "${YUM_REPO_FILE}" ]; then
|
||||
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
|
||||
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
|
||||
## Amazon Linux yum (v3) doesn't support config-manager
|
||||
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
|
||||
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
|
||||
# shellcheck disable=SC2129
|
||||
if [ "$ONEDIR_REV" != "latest" ]; then
|
||||
# 3006.x is default, and latest for 3006.x branch
|
||||
if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then
|
||||
|
@ -5716,14 +5715,34 @@ install_amazon_linux_ami_2_onedir_deps() {
|
|||
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
|
||||
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
|
||||
# Enable the Salt 3007 STS repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-3007-sts
|
||||
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
else
|
||||
# Salt 3006 repo
|
||||
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
fi
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# using minor version
|
||||
echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}"
|
||||
# shellcheck disable=SC2129
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}"
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
|
@ -5734,11 +5753,18 @@ install_amazon_linux_ami_2_onedir_deps() {
|
|||
fi
|
||||
else
|
||||
# Enable the Salt LATEST repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-latest
|
||||
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
fi
|
||||
dnf clean expire-cache || return 1
|
||||
dnf makecache || return 1
|
||||
yum clean expire-cache || return 1
|
||||
yum makecache || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -5824,10 +5850,7 @@ install_amazon_linux_ami_2023_git_deps() {
|
|||
# shellcheck disable=SC2119
|
||||
__git_clone_and_checkout || return 1
|
||||
|
||||
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="python${PY_PKG_VER}-pip python${PY_PKG_VER}-setuptools python${PY_PKG_VER}-devel gcc sudo"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
__yum_install_noinput ${__PACKAGES} || return 1
|
||||
|
@ -5841,14 +5864,18 @@ install_amazon_linux_ami_2023_git_deps() {
|
|||
return 0
|
||||
}
|
||||
|
||||
install_amazon_linux_ami_2023_deps() {
|
||||
|
||||
# Set ONEDIR_REV to STABLE_REV
|
||||
ONEDIR_REV=${STABLE_REV}
|
||||
install_amazon_linux_ami_2023_onedir_deps || return 1
|
||||
}
|
||||
|
||||
install_amazon_linux_ami_2023_onedir_deps() {
|
||||
|
||||
# We need to install yum-utils before doing anything else when installing on
|
||||
# Amazon Linux ECS-optimized images. See issue #974.
|
||||
__PACKAGES="yum-utils"
|
||||
|
||||
# ensure sudo installed
|
||||
__PACKAGES="${__PACKAGES} sudo"
|
||||
__PACKAGES="yum-utils chkconfig procps-ng findutils sudo"
|
||||
|
||||
__yum_install_noinput ${__PACKAGES}
|
||||
|
||||
|
@ -5859,8 +5886,10 @@ install_amazon_linux_ami_2023_onedir_deps() {
|
|||
|
||||
if [ $_DISABLE_REPOS -eq $BS_FALSE ] || [ "$_CUSTOM_REPO_URL" != "null" ]; then
|
||||
if [ ! -s "${YUM_REPO_FILE}" ]; then
|
||||
FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
|
||||
__fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
|
||||
## Amazon Linux yum (v3) doesn't support config-manager
|
||||
## FETCH_URL="https://github.com/saltstack/salt-install-guide/releases/latest/download/salt.repo"
|
||||
## __fetch_url "${YUM_REPO_FILE}" "${FETCH_URL}"
|
||||
# shellcheck disable=SC2129
|
||||
if [ "$ONEDIR_REV" != "latest" ]; then
|
||||
# 3006.x is default, and latest for 3006.x branch
|
||||
if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then
|
||||
|
@ -5868,14 +5897,34 @@ install_amazon_linux_ami_2023_onedir_deps() {
|
|||
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
|
||||
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
|
||||
# Enable the Salt 3007 STS repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-3007-sts
|
||||
echo "[salt-repo-3007-sts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3007 STS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "exclude=*3006* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
else
|
||||
# Salt 3006 repo
|
||||
echo "[salt-repo-3006-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3006 LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "exclude=*3007* *3008* *3009* *3010*" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
fi
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# using minor version
|
||||
echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}"
|
||||
# shellcheck disable=SC2129
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}"
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
|
@ -5886,11 +5935,18 @@ install_amazon_linux_ami_2023_onedir_deps() {
|
|||
fi
|
||||
else
|
||||
# Enable the Salt LATEST repo
|
||||
dnf config-manager --set-disable salt-repo-*
|
||||
dnf config-manager --set-enabled salt-repo-latest
|
||||
echo "[salt-repo-latest]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt LATEST release" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled=1" >> "${YUM_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${YUM_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${YUM_REPO_FILE}"
|
||||
fi
|
||||
dnf clean expire-cache || return 1
|
||||
dnf makecache || return 1
|
||||
yum clean expire-cache || return 1
|
||||
yum makecache || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -6286,8 +6342,9 @@ __install_saltstack_photon_onedir_repository() {
|
|||
fi
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# using minor version
|
||||
echo "[salt-repo-${ONEDIR_REV}-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV} LTS" >> "${YUM_REPO_FILE}"
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${YUM_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${YUM_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${YUM_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${YUM_REPO_FILE}"
|
||||
echo "priority=10" >> "${YUM_REPO_FILE}"
|
||||
|
@ -6582,7 +6639,8 @@ install_photon_onedir() {
|
|||
MINOR_VER_STRG="-$_GENERIC_PKG_VERSION"
|
||||
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# Minor version Salt, need to add specific minor version
|
||||
MINOR_VER_STRG="-$STABLE_REV"
|
||||
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
|
||||
MINOR_VER_STRG="-$STABLE_REV_DOT"
|
||||
else
|
||||
# default to latest version Salt, config and repo already setup
|
||||
__get_packagesite_onedir_latest
|
||||
|
@ -6632,38 +6690,85 @@ install_photon_onedir_post() {
|
|||
#
|
||||
__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}" -eq 15 ] && [ "${DISTRO_MINOR_VERSION}" -ge 4 ]; then
|
||||
DISTRO_REPO="${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
|
||||
elif [ "${DISTRO_MAJOR_VERSION}" -ge 42 ] || [ "${DISTRO_MAJOR_VERSION}" -eq 15 ]; then
|
||||
DISTRO_REPO="openSUSE_Leap_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
|
||||
else
|
||||
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}_SP${SUSE_PATCHLEVEL}"
|
||||
fi
|
||||
|
||||
suse_pkg_url_base="https://download.opensuse.org/repositories/systemsmanagement:/saltstack"
|
||||
suse_pkg_url_path="${DISTRO_REPO}/systemsmanagement:saltstack.repo"
|
||||
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 -q systemsmanagement_saltstack
|
||||
__zypper repos | grep -q 'salt.repo'
|
||||
|
||||
if [ $? -eq 1 ]; then
|
||||
# zypper does not yet know anything about systemsmanagement_saltstack
|
||||
__zypper addrepo --refresh "${SUSE_PKG_URL}" || return 1
|
||||
# zypper does not yet know anything about salt.repo
|
||||
# zypper does not support exclude similar to Photon, hence have to do following
|
||||
ZYPPER_REPO_FILE="/etc/zypp/repos.d/salt.repo"
|
||||
# shellcheck disable=SC2129
|
||||
if [ "$ONEDIR_REV" != "latest" ]; then
|
||||
# 3006.x is default, and latest for 3006.x branch
|
||||
if [ "$(echo "$ONEDIR_REV" | grep -E '^(3006|3007)$')" != "" ]; then
|
||||
# latest version for branch 3006 | 3007
|
||||
REPO_REV_MAJOR=$(echo "$ONEDIR_REV" | cut -d '.' -f 1)
|
||||
if [ "$REPO_REV_MAJOR" -eq "3007" ]; then
|
||||
# Enable the Salt 3007 STS repo
|
||||
echo "[salt-repo-3007-sts]" > "${ZYPPER_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3007 STS" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "priority=10" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "exclude=*3006* *3008* *3009* *3010*" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${ZYPPER_REPO_FILE}"
|
||||
zypper addlock "salt-* < 3007" && zypper addlock "salt-* >= 3008"
|
||||
else
|
||||
# Salt 3006 repo
|
||||
echo "[salt-repo-3006-lts]" > "${ZYPPER_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v3006 LTS" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "priority=10" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "exclude=*3007* *3008* *3009* *3010*" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${ZYPPER_REPO_FILE}"
|
||||
zypper addlock "salt-* < 3006" && zypper addlock "salt-* >= 3007"
|
||||
fi
|
||||
elif [ "$(echo "$ONEDIR_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# using minor version
|
||||
ONEDIR_REV_DOT=$(echo "$ONEDIR_REV" | sed 's/-/\./')
|
||||
echo "[salt-repo-${ONEDIR_REV_DOT}-lts]" > "${ZYPPER_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt v${ONEDIR_REV_DOT} LTS" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "priority=10" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${ZYPPER_REPO_FILE}"a
|
||||
ONEDIR_MAJ_VER=$(echo "${ONEDIR_REV_DOT}" | awk -F '.' '{print $1}')
|
||||
# shellcheck disable=SC2004
|
||||
ONEDIR_MAJ_VER_PLUS=$((${ONEDIR_MAJ_VER} + 1))
|
||||
zypper addlock "salt-* < ${ONEDIR_MAJ_VER}" && zypper addlock "salt-* >= ${ONEDIR_MAJ_VER_PLUS}"
|
||||
fi
|
||||
else
|
||||
# Enable the Salt LATEST repo
|
||||
echo "[salt-repo-latest]" > "${ZYPPER_REPO_FILE}"
|
||||
echo "name=Salt Repo for Salt LATEST release" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "baseurl=https://${_REPO_URL}/saltproject-rpm/" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "skip_if_unavailable=True" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "priority=10" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "enabled_metadata=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgcheck=1" >> "${ZYPPER_REPO_FILE}"
|
||||
echo "gpgkey=https://${_REPO_URL}/api/security/keypair/SaltProjectKey/public" >> "${ZYPPER_REPO_FILE}"
|
||||
fi
|
||||
__zypper addrepo --refresh "${ZYPPER_REPO_FILE}" || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
__version_lte() {
|
||||
if ! __check_command_exists python; then
|
||||
zypper --non-interactive install --replacefiles --auto-agree-with-licenses python || \
|
||||
zypper --non-interactive install --auto-agree-with-licenses python || return 1
|
||||
if ! __check_command_exists python3; then
|
||||
zypper --non-interactive install --replacefiles --auto-agree-with-licenses python3 || \
|
||||
zypper --non-interactive install --auto-agree-with-licenses python3 || return 1
|
||||
fi
|
||||
|
||||
if [ "$(${_PY_EXE} -c 'import sys; V1=tuple([int(i) for i in sys.argv[1].split(".")]); V2=tuple([int(i) for i in sys.argv[2].split(".")]); print(V1<=V2)' "$1" "$2")" = "True" ]; then
|
||||
|
@ -6707,8 +6812,6 @@ __zypper_install() {
|
|||
__opensuse_prep_install() {
|
||||
# DRY function for common installation preparatory steps for SUSE
|
||||
if [ "$_DISABLE_REPOS" -eq $BS_FALSE ]; then
|
||||
# Is the repository already known
|
||||
__set_suse_pkg_repo
|
||||
# Check zypper repos and refresh if necessary
|
||||
__check_and_refresh_suse_pkg_repo
|
||||
fi
|
||||
|
@ -6795,7 +6898,8 @@ install_opensuse_stable() {
|
|||
MINOR_VER_STRG=""
|
||||
elif [ "$(echo "$STABLE_REV" | grep -E '^([3-9][0-5]{2}[6-9](\.[0-9]*)?)')" != "" ]; then
|
||||
# Minor version Salt, need to add specific minor version
|
||||
MINOR_VER_STRG="-$STABLE_REV"
|
||||
STABLE_REV_DOT=$(echo "$STABLE_REV" | sed 's/-/\./')
|
||||
MINOR_VER_STRG="-$STABLE_REV_DOT"
|
||||
else
|
||||
MINOR_VER_STRG=""
|
||||
fi
|
||||
|
@ -7110,12 +7214,94 @@ install_suse_15_restart_daemons() {
|
|||
return 0
|
||||
}
|
||||
|
||||
install_suse_15_check_services() {
|
||||
install_opensuse_check_services || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# End of SUSE Enterprise 15
|
||||
#
|
||||
#######################################################################################################################
|
||||
|
||||
|
||||
#######################################################################################################################
|
||||
#
|
||||
# SUSE Enterprise 15, now has ID sled
|
||||
#
|
||||
|
||||
install_sled_15_stable_deps() {
|
||||
__opensuse_prep_install || return 1
|
||||
install_opensuse_15_stable_deps || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_git_deps() {
|
||||
install_suse_15_stable_deps || return 1
|
||||
|
||||
if ! __check_command_exists git; then
|
||||
__zypper_install git-core || return 1
|
||||
fi
|
||||
|
||||
install_opensuse_15_git_deps || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_onedir_deps() {
|
||||
__opensuse_prep_install || return 1
|
||||
install_opensuse_15_onedir_deps || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_stable() {
|
||||
install_opensuse_stable || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_git() {
|
||||
install_opensuse_15_git || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_onedir() {
|
||||
install_opensuse_stable || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_stable_post() {
|
||||
install_opensuse_stable_post || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_git_post() {
|
||||
install_opensuse_git_post || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_onedir_post() {
|
||||
install_opensuse_stable_post || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_restart_daemons() {
|
||||
install_opensuse_restart_daemons || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
install_sled_15_check_services() {
|
||||
install_opensuse_check_services || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
# End of SUSE Enterprise 15 aka sled
|
||||
#
|
||||
#######################################################################################################################
|
||||
|
||||
|
||||
#######################################################################################################################
|
||||
#
|
||||
# Gentoo Install Functions.
|
||||
|
|
|
@ -4,27 +4,31 @@
|
|||
#
|
||||
# pip-compile requirements/release.in
|
||||
#
|
||||
attrs==23.1.0
|
||||
annotated-types==0.7.0
|
||||
# via pydantic
|
||||
attrs==24.3.0
|
||||
# via python-tools-scripts
|
||||
boto3==1.28.79
|
||||
boto3==1.35.98
|
||||
# via -r requirements/release.in
|
||||
botocore==1.31.79
|
||||
botocore==1.35.98
|
||||
# via
|
||||
# boto3
|
||||
# s3transfer
|
||||
certifi==2023.7.22
|
||||
certifi==2024.12.14
|
||||
# via requests
|
||||
cfgv==3.4.0
|
||||
# via pre-commit
|
||||
charset-normalizer==3.3.2
|
||||
charset-normalizer==3.4.1
|
||||
# via requests
|
||||
distlib==0.3.7
|
||||
distlib==0.3.9
|
||||
# via virtualenv
|
||||
filelock==3.13.1
|
||||
# via virtualenv
|
||||
identify==2.5.31
|
||||
filelock==3.16.1
|
||||
# via
|
||||
# python-tools-scripts
|
||||
# virtualenv
|
||||
identify==2.6.5
|
||||
# via pre-commit
|
||||
idna==3.4
|
||||
idna==3.10
|
||||
# via requests
|
||||
jmespath==1.0.1
|
||||
# via
|
||||
|
@ -34,36 +38,41 @@ markdown-it-py==3.0.0
|
|||
# via rich
|
||||
mdurl==0.1.2
|
||||
# via markdown-it-py
|
||||
nodeenv==1.8.0
|
||||
nodeenv==1.9.1
|
||||
# via pre-commit
|
||||
platformdirs==3.11.0
|
||||
platformdirs==4.3.6
|
||||
# via virtualenv
|
||||
pre-commit==3.5.0
|
||||
pre-commit==4.0.1
|
||||
# via -r requirements/release.in
|
||||
pygments==2.16.1
|
||||
pydantic==2.10.5
|
||||
# via python-tools-scripts
|
||||
pydantic-core==2.27.2
|
||||
# via pydantic
|
||||
pygments==2.19.1
|
||||
# via rich
|
||||
python-dateutil==2.8.2
|
||||
python-dateutil==2.9.0.post0
|
||||
# via botocore
|
||||
python-tools-scripts==0.18.6
|
||||
python-tools-scripts==0.20.5
|
||||
# via -r requirements/release.in
|
||||
pyyaml==6.0.1
|
||||
pyyaml==6.0.2
|
||||
# via pre-commit
|
||||
requests==2.31.0
|
||||
requests==2.32.3
|
||||
# via python-tools-scripts
|
||||
rich==13.6.0
|
||||
rich==13.9.4
|
||||
# via python-tools-scripts
|
||||
s3transfer==0.7.0
|
||||
s3transfer==0.10.4
|
||||
# via boto3
|
||||
six==1.16.0
|
||||
six==1.17.0
|
||||
# via python-dateutil
|
||||
typing-extensions==4.8.0
|
||||
# via python-tools-scripts
|
||||
urllib3==2.0.7
|
||||
typing-extensions==4.12.2
|
||||
# via
|
||||
# pydantic
|
||||
# pydantic-core
|
||||
# python-tools-scripts
|
||||
# rich
|
||||
urllib3==2.3.0
|
||||
# via
|
||||
# botocore
|
||||
# requests
|
||||
virtualenv==20.24.6
|
||||
virtualenv==20.28.1
|
||||
# via pre-commit
|
||||
|
||||
# The following packages are considered to be unsafe in a requirements file:
|
||||
# setuptools
|
||||
|
|
|
@ -1,39 +1,31 @@
|
|||
function Convert-PSObjectToHashtable {
|
||||
param (
|
||||
[Parameter(ValueFromPipeline)]
|
||||
$InputObject
|
||||
)
|
||||
if ($null -eq $InputObject) { return $null }
|
||||
<#
|
||||
.SYNOPSIS
|
||||
A simple Powershell script to quickly start using Salt.
|
||||
|
||||
$is_enum = $InputObject -is [System.Collections.IEnumerable]
|
||||
$not_string = $InputObject -isnot [string]
|
||||
if ($is_enum -and $not_string) {
|
||||
$collection = @(
|
||||
foreach ($object in $InputObject) {
|
||||
Convert-PSObjectToHashtable $object
|
||||
}
|
||||
)
|
||||
.DESCRIPTION
|
||||
This script will download the latest onedir version of Salt and extract it
|
||||
into the same directory where the script is run. The script sets up an
|
||||
environment that will allow you to run salt-call commands. To remove, just
|
||||
delete the `salt` directory. The environment variables will only be set for
|
||||
the current powershell session.
|
||||
|
||||
Write-Host -NoEnumerate $collection
|
||||
} elseif ($InputObject -is [PSObject]) {
|
||||
$hash = @{}
|
||||
.EXAMPLE
|
||||
./salt-quick-start.ps1
|
||||
|
||||
foreach ($property in $InputObject.PSObject.Properties) {
|
||||
$hash[$property.Name] = Convert-PSObjectToHashtable $property.Value
|
||||
}
|
||||
.LINK
|
||||
Salt Bootstrap GitHub Project (script home) - https://github.com/saltstack/salt-bootstrap
|
||||
Original Vagrant Provisioner Project - https://github.com/saltstack/salty-vagrant
|
||||
Vagrant Project (utilizes this script) - https://github.com/mitchellh/vagrant
|
||||
Salt Download Location - https://packages.broadcom.com/artifactory/saltproject-generic/windows/
|
||||
Salt Manual Install Directions (Windows) - https://docs.saltproject.io/salt/install-guide/en/latest/topics/install-by-operating-system/windows.html
|
||||
#>
|
||||
|
||||
$hash
|
||||
} else {
|
||||
$InputObject
|
||||
}
|
||||
}
|
||||
# This is so the -Verbose parameter will work
|
||||
[CmdletBinding()] param()
|
||||
|
||||
function Expand-ZipFile {
|
||||
# Extract a zip file
|
||||
#
|
||||
# Used by:
|
||||
# - Install-SaltMinion
|
||||
#
|
||||
# Args:
|
||||
# ZipFile (string): The file to extract
|
||||
# Destination (string): The location to extract to
|
||||
|
@ -81,60 +73,151 @@ function Expand-ZipFile {
|
|||
Write-Debug "Finished unzipping '$ZipFile' to '$Destination'"
|
||||
}
|
||||
|
||||
function Get-FileHash {
|
||||
# Get-FileHash is a built-in cmdlet in powershell 5+ but we need to support
|
||||
# powershell 3. This will overwrite the powershell 5 commandlet only for
|
||||
# this script. But it will provide the missing cmdlet for powershell 3
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String] $Path,
|
||||
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'
|
||||
[Parameter(Mandatory=$false)]
|
||||
[ValidateSet(
|
||||
"SHA1",
|
||||
"SHA256",
|
||||
"SHA384",
|
||||
"SHA512",
|
||||
# https://serverfault.com/questions/820300/
|
||||
# why-isnt-mactripledes-algorithm-output-in-powershell-stable
|
||||
"MACTripleDES", # don't use
|
||||
"MD5",
|
||||
"RIPEMD160",
|
||||
IgnoreCase=$true)]
|
||||
[String] $Algorithm = "SHA256"
|
||||
)
|
||||
|
||||
$global:ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
$RepoUrl = "https://repo.saltproject.io/salt/py3/onedir"
|
||||
|
||||
if ([IntPtr]::Size -eq 4) {
|
||||
$arch = "x86"
|
||||
} else {
|
||||
$arch = "amd64"
|
||||
}
|
||||
$enc = [System.Text.Encoding]::UTF8
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri "$RepoUrl/repo.json" -UseBasicParsing
|
||||
if ($response.Content.GetType().Name -eq "Byte[]") {
|
||||
$psobj = $enc.GetString($response.Content) | ConvertFrom-Json
|
||||
|
||||
} else {
|
||||
$psobj = $response.Content | ConvertFrom-Json
|
||||
if ( !(Test-Path $Path) ) {
|
||||
Write-Verbose "Invalid path for hashing: $Path"
|
||||
return @{}
|
||||
}
|
||||
$hash = Convert-PSObjectToHashtable $psobj
|
||||
} catch {
|
||||
Write-Host "repo.json not found at: $RepoUrl"
|
||||
$hash = @{}
|
||||
}
|
||||
$searchVersion = "latest"
|
||||
if ( $hash.Contains($searchVersion)) {
|
||||
foreach ($item in $hash.($searchVersion).Keys) {
|
||||
if ( $item.EndsWith(".zip") ) {
|
||||
if ( $item.Contains($arch) ) {
|
||||
$saltFileName = $hash.($searchVersion).($item).name
|
||||
$saltVersion = $hash.($searchVersion).($item).version
|
||||
$saltSha512 = $hash.($searchVersion).($item).SHA512
|
||||
}
|
||||
|
||||
if ( (Get-Item -Path $Path) -isnot [System.IO.FileInfo]) {
|
||||
Write-Verbose "Not a file for hashing: $Path"
|
||||
return @{}
|
||||
}
|
||||
|
||||
$Path = Resolve-Path -Path $Path
|
||||
|
||||
Switch ($Algorithm) {
|
||||
SHA1 {
|
||||
$hasher = [System.Security.Cryptography.SHA1CryptoServiceProvider]::Create()
|
||||
}
|
||||
SHA256 {
|
||||
$hasher = [System.Security.Cryptography.SHA256]::Create()
|
||||
}
|
||||
SHA384 {
|
||||
$hasher = [System.Security.Cryptography.SHA384]::Create()
|
||||
}
|
||||
SHA512 {
|
||||
$hasher = [System.Security.Cryptography.SHA512]::Create()
|
||||
}
|
||||
MACTripleDES {
|
||||
$hasher = [System.Security.Cryptography.MACTripleDES]::Create()
|
||||
}
|
||||
MD5 {
|
||||
$hasher = [System.Security.Cryptography.MD5]::Create()
|
||||
}
|
||||
RIPEMD160 {
|
||||
$hasher = [System.Security.Cryptography.RIPEMD160]::Create()
|
||||
}
|
||||
}
|
||||
|
||||
Write-Verbose "Hashing using $Algorithm algorithm"
|
||||
try {
|
||||
$data = [System.IO.File]::OpenRead($Path)
|
||||
$hash = $hasher.ComputeHash($data)
|
||||
$hash = [System.BitConverter]::ToString($hash) -replace "-",""
|
||||
return @{
|
||||
Path = $Path;
|
||||
Algorithm = $Algorithm.ToUpper();
|
||||
Hash = $hash
|
||||
}
|
||||
} catch {
|
||||
Write-Verbose "Error hashing: $Path"
|
||||
Write-Verbose "ERROR: $_"
|
||||
return @{}
|
||||
} finally {
|
||||
if ($null -ne $data) {
|
||||
$data.Close()
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $saltFileName -and $saltVersion -and $saltSha512 ) {
|
||||
if ( $RepoUrl.Contains("minor") ) {
|
||||
$saltFileUrl = @($RepoUrl, $saltVersion, $saltFileName) -join "/"
|
||||
} else {
|
||||
$saltFileUrl = @($RepoUrl, "minor", $saltVersion, $saltFileName) -join "/"
|
||||
}
|
||||
|
||||
#===============================================================================
|
||||
# Script settings
|
||||
#===============================================================================
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls12'
|
||||
$global:ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
#===============================================================================
|
||||
# Declare Variables
|
||||
#===============================================================================
|
||||
$ApiUrl = "https://packages.broadcom.com/artifactory/api/storage/saltproject-generic/onedir"
|
||||
# Detect architecture ($arch)
|
||||
if ([IntPtr]::Size -eq 4) { $arch = "x86" } else { $arch = "amd64" }
|
||||
|
||||
#===============================================================================
|
||||
# Setting up quickstart environment
|
||||
#===============================================================================
|
||||
Write-Host ""
|
||||
Write-Host "Setting up quickstart environment for Salt" -ForegroundColor Cyan
|
||||
|
||||
Write-Verbose "Getting version information from Artifactory"
|
||||
$response = Invoke-WebRequest $ApiUrl -UseBasicParsing
|
||||
# Convert the output to a powershell object
|
||||
$psobj = $response.ToString() | ConvertFrom-Json
|
||||
$Version = $psobj.children[-1].uri.Trim("/")
|
||||
|
||||
Write-Verbose "Getting sha256 hash and download url from Artifactory"
|
||||
$saltFileName = "salt-$Version-onedir-windows-$arch.zip"
|
||||
$response = Invoke-WebRequest "$ApiUrl/$Version/$saltFileName" -UseBasicParsing
|
||||
$psobj = $response.ToString() | ConvertFrom-Json
|
||||
$saltFileUrl = $psobj.downloadUri
|
||||
$saltSha256 = $psobj.checksums.sha256
|
||||
|
||||
Write-Verbose "URL: $saltFileUrl"
|
||||
Write-Host "* INFO: Downloading Salt: " -NoNewline
|
||||
Invoke-WebRequest -Uri $saltFileUrl -OutFile .\salt.zip
|
||||
if ( Test-Path -Path .\salt.zip ) {
|
||||
Write-Host "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
$localSha256 = (Get-FileHash -Path .\salt.zip -Algorithm SHA256).Hash
|
||||
Write-Verbose "Local Hash: $localSha256"
|
||||
Write-Verbose "Remote Hash: $saltSha256"
|
||||
|
||||
Write-Host "* INFO: Comparing Hash: " -NoNewline
|
||||
if ( $localSha256 -eq $saltSha256 ) {
|
||||
Write-Host "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "* INFO: Downloading Salt"
|
||||
Invoke-WebRequest -Uri $saltFileUrl -OutFile .\salt.zip
|
||||
|
||||
Write-Host "* INFO: Extracting Salt"
|
||||
Write-Host "* INFO: Extracting Salt: " -NoNewline
|
||||
Expand-ZipFile -ZipFile .\salt.zip -Destination .
|
||||
if ( Test-Path -Path .\salt\Scripts\python.exe ) {
|
||||
Write-Host "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "* INFO: Creating Saltfile: " -NoNewline
|
||||
$PATH = $(Get-Location).Path
|
||||
|
||||
$saltfile_contents = @"
|
||||
salt-call:
|
||||
local: True
|
||||
|
@ -143,20 +226,42 @@ salt-call:
|
|||
cachedir: $PATH\salt\var\cache\salt
|
||||
file_root: $PATH\salt\srv\salt
|
||||
"@
|
||||
|
||||
Set-Content -Path .\salt\Saltfile -Value $saltfile_contents
|
||||
if ( Test-Path -Path .\salt\Saltfile ) {
|
||||
Write-Host "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
New-Item -Path "$PATH\salt\var\log\salt" -Type Directory -Force | Out-Null
|
||||
New-Item -Path "$PATH\salt\conf" -Type Directory -Force | Out-Null
|
||||
New-Item -Path "$PATH\salt\var\cache\salt" -Type Directory -Force | Out-Null
|
||||
New-Item -Path "$PATH\salt\srv\salt" -Type Directory -Force | Out-Null
|
||||
|
||||
Write-Host "* INFO: Adding Salt to current path"
|
||||
Write-Host "* INFO: $PATH\salt"
|
||||
Write-Host "* INFO: Adding Salt to current path: " -NoNewline
|
||||
$env:Path = "$PATH\salt;$env:PATH"
|
||||
Write-Verbose $env:Path
|
||||
if ( $env:PATH -Like "*$PATH\salt*" ) {
|
||||
Write-Host "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "* INFO: $PATH\salt"
|
||||
|
||||
Write-Host "* INFO: Setting the SALT_SALTFILE environment variable"
|
||||
Write-Host "* INFO: $PATH\salt\Saltfile"
|
||||
Write-Host "* INFO: Setting the SALT_SALTFILE environment variable: "-NoNewline
|
||||
$env:SALT_SALTFILE="$PATH\salt\Saltfile"
|
||||
if ( Test-Path -Path $env:SALT_SALTFILE ) {
|
||||
Write-Host "Success" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Failed" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
Write-Host "* INFO: $PATH\salt\Saltfile"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "You can now run simple salt-call commands" -ForegroundColor Cyan
|
||||
Write-Host "* INFO: Create Salt states in $PATH\salt\srv\salt"
|
||||
Write-Host "* INFO: Try running salt-call test.ping"
|
||||
Write-Host ""
|
||||
|
|
|
@ -35,10 +35,21 @@ def run_salt_call(cmd):
|
|||
log.error(f"failed to produce output result, '{result}'")
|
||||
|
||||
else:
|
||||
cmdl = ["sudo"]
|
||||
if platform.system() == "Darwin":
|
||||
cmdl = ["sudo"]
|
||||
else:
|
||||
cmdl = []
|
||||
cmdl.extend(cmd)
|
||||
cmdl.append("--out=json")
|
||||
result = subprocess.run(cmdl, capture_output=True, text=True)
|
||||
try:
|
||||
result = subprocess.run(cmdl, capture_output=True, text=True)
|
||||
except TypeError:
|
||||
result = subprocess.run(
|
||||
cmdl,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
universal_newlines=True,
|
||||
)
|
||||
if 0 == result.returncode:
|
||||
json_data = json.loads(result.stdout)
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue