From 455797675cbbd7a8e67ed9a45d70d5e8500befec Mon Sep 17 00:00:00 2001 From: N Date: Mon, 29 Jul 2019 23:32:46 +0100 Subject: [PATCH 1/5] fix(os): pass state on unsupported os --- salt/pkgrepo/arch | 1 + salt/pkgrepo/freebsd | 1 + salt/pkgrepo/macos | 1 + salt/pkgrepo/nop/clean.sls | 7 +++++++ salt/pkgrepo/nop/init.sls | 5 +++++ salt/pkgrepo/nop/install.sls | 7 +++++++ 6 files changed, 22 insertions(+) create mode 120000 salt/pkgrepo/arch create mode 120000 salt/pkgrepo/freebsd create mode 120000 salt/pkgrepo/macos create mode 100644 salt/pkgrepo/nop/clean.sls create mode 100644 salt/pkgrepo/nop/init.sls create mode 100644 salt/pkgrepo/nop/install.sls diff --git a/salt/pkgrepo/arch b/salt/pkgrepo/arch new file mode 120000 index 0000000..0595218 --- /dev/null +++ b/salt/pkgrepo/arch @@ -0,0 +1 @@ +nop/ \ No newline at end of file diff --git a/salt/pkgrepo/freebsd b/salt/pkgrepo/freebsd new file mode 120000 index 0000000..0595218 --- /dev/null +++ b/salt/pkgrepo/freebsd @@ -0,0 +1 @@ +nop/ \ No newline at end of file diff --git a/salt/pkgrepo/macos b/salt/pkgrepo/macos new file mode 120000 index 0000000..0595218 --- /dev/null +++ b/salt/pkgrepo/macos @@ -0,0 +1 @@ +nop/ \ No newline at end of file diff --git a/salt/pkgrepo/nop/clean.sls b/salt/pkgrepo/nop/clean.sls new file mode 100644 index 0000000..f535f7f --- /dev/null +++ b/salt/pkgrepo/nop/clean.sls @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +salt-pkgrepo-clean-saltstack-norepo-{{ grains['os_family']|lower }}: + test.show_notification: + - text: | + No official repository for {{ grains['os_family'] }} diff --git a/salt/pkgrepo/nop/init.sls b/salt/pkgrepo/nop/init.sls new file mode 100644 index 0000000..d3e5518 --- /dev/null +++ b/salt/pkgrepo/nop/init.sls @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +include: + - .install diff --git a/salt/pkgrepo/nop/install.sls b/salt/pkgrepo/nop/install.sls new file mode 100644 index 0000000..55e3907 --- /dev/null +++ b/salt/pkgrepo/nop/install.sls @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +salt-pkgrepo-install-saltstack-norepo-{{ grains['os_family']|lower }}: + test.show_notification: + - text: | + No official repository for {{ grains['os_family'] }} From 14276e2074067b47e85f8d2746a592ca2a2c3a58 Mon Sep 17 00:00:00 2001 From: N Date: Thu, 1 Aug 2019 01:27:49 +0100 Subject: [PATCH 2/5] fix(macos): fix minion package handling for homebrew --- salt/defaults.yaml | 2 ++ salt/minion.sls | 47 +++++++++++++++++++++++++++---------------- salt/osfamilymap.yaml | 11 +++++++++- 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/salt/defaults.yaml b/salt/defaults.yaml index 44ea3aa..afe1420 100644 --- a/salt/defaults.yaml +++ b/salt/defaults.yaml @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # vim: ft=yaml salt: + version: '' + rootuser: root install_packages: True use_pip: False clean_config_d_dir: True diff --git a/salt/minion.sls b/salt/minion.sls index 391defa..43ca54e 100644 --- a/salt/minion.sls +++ b/salt/minion.sls @@ -2,14 +2,15 @@ {%- from tplroot ~ "/map.jinja" import salt_settings with context %} {%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} -{% if salt_settings.install_packages and grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source != '' and salt_settings.version != '' %} -{# only download IF we know where to get the pkg from and if we know what version to check the current install (if installed) against #} -{# e.g. don't download unless it appears as though we're about to try and upgrade the minion #} +{% if salt_settings.install_packages and grains.os == 'MacOS' %} download-salt-minion: + {% if salt_settings.salt_minion_pkg_source %} + {# only download IF we know where to get the pkg from and what version to check the current install (if installed) against #} + {# e.g. don't download unless it appears as though we're about to try and upgrade the minion #} file.managed: - name: '/tmp/salt.pkg' - source: {{ salt_settings.salt_minion_pkg_source }} - {% if salt_settings.salt_minion_pkg_hash != '' %} + {%- if salt_settings.salt_minion_pkg_hash %} - source_hash: {{ salt_settings.salt_minion_pkg_hash }} {% else %} - skip_verify: True @@ -18,27 +19,36 @@ download-salt-minion: - group: wheel - mode: 0644 - unless: - - '/opt/salt/bin/salt-minion --version | grep {{ salt_settings.version }}' + - test -n "{{ salt_settings.version }}" && '/opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.*' - require_in: - macpackage: salt-minion + {%- elif "workaround https://github.com/saltstack/salt/issues/49348" %} + cmd.run: + - name: /usr/local/bin/brew install {{ salt_settings.salt_minion }} + - onlyif: test -x /usr/local/bin/brew + - runas: {{ salt_settings.rootuser }} + {%- endif %} {% endif %} salt-minion: {% if salt_settings.install_packages %} - {%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source != '' and salt_settings.version != '' %} + {%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %} macpackage.installed: - name: '/tmp/salt.pkg' - target: / {# macpackage.installed behaves weirdly with version_check; version_check detects difference but fails to actually complete install. #} {# use force == True as workaround #} - force: True - - version_check: /opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.* + - unless: + - test -n "{{ salt_settings.version }}" && '/opt/salt/bin/salt-minion --version=.*{{ salt_settings.version }}.*' - require_in: - service: salt-minion - {%- else %} + - onchanges_in: + - cmd: remove-macpackage-salt + {%- elif grains.os != 'MacOS' and "workaround https://github.com/saltstack/salt/issues/49348" %} pkg.installed: - name: {{ salt_settings.salt_minion }} - {%- if salt_settings.version is defined %} + {%- if salt_settings.version %} - version: {{ salt_settings.version }} {%- endif %} - require_in: @@ -89,8 +99,10 @@ salt-minion: {%- endif %} - onchanges: {%- if salt_settings.install_packages %} - {%- if grains.os == 'MacOS' %} + {%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %} - macpackage: salt-minion + {%- elif grains.os == 'MacOS' %} + - cmd: download-salt-minion {%- else %} - pkg: salt-minion {%- endif %} @@ -113,11 +125,13 @@ restart-salt-minion: - pkg: at - onchanges: {%- if salt_settings.install_packages %} - {%- if grains.os == 'MacOS' %} + {%- if grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source %} - macpackage: salt-minion - {%- else %} + {%- elif grains.os == 'MacOS' %} + - cmd: download-salt-minion + {%- else %} - pkg: salt-minion - {%- endif %} + {%- endif %} {%- endif %} - file: salt-minion - file: remove-old-minion-conf-file @@ -146,8 +160,7 @@ remove-old-minion-conf-file: {% if grains.os == 'MacOS' %} remove-macpackage-salt: - cmd.run: - - name: 'rm -f /tmp/salt.pkg' - - onchanges: - - macpackage: salt-minion + file.absent: + - name: /tmp/salt.pkg + - force: True {% endif %} diff --git a/salt/osfamilymap.yaml b/salt/osfamilymap.yaml index b0a5fc0..a1f5684 100644 --- a/salt/osfamilymap.yaml +++ b/salt/osfamilymap.yaml @@ -14,6 +14,12 @@ {% set osmajorrelease = salt['grains.get']('osmajorrelease', osrelease)|string %} {% set oscodename = salt['grains.get']('oscodename') %} +#from template-formula +{%- if grains.os == 'MacOS' %} + {%- set macos_rootuser = salt['cmd.run']("stat -f '%Su' /dev/console") %} + {%- set macos_rootgroup = salt['cmd.run']("stat -f '%Sg' /dev/console") %} +{%- endif %} + Debian: pkgrepo: 'deb http://repo.saltstack.com/{{ py_ver_repr }}/{{ osfamily_lower }}/{{ osmajorrelease }}/amd64/{{ salt_release }} {{ oscodename }} main' key_url: 'https://repo.saltstack.com/{{ py_ver_repr }}/{{ osfamily_lower }}/{{ osmajorrelease }}/amd64/{{ salt_release }}/SALTSTACK-GPG-KEY.pub' @@ -122,8 +128,11 @@ Windows: minion_service: salt-minion MacOS: - salt_minion: com.saltstack.salt + salt_minion: salt salt_minion_pkg_source: '' salt_minion_pkg_hash: '' config_path: /private/etc/salt minion_service: com.saltstack.salt.minion + ## from template-formula + rootuser: {{ macos_rootuser | d('') }} + rootgroup: {{ macos_rootgroup | d('') }} From 5fcadcdc590609b7a1d0d580000fb6493b5ca2e8 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Thu, 1 Aug 2019 06:01:13 +0100 Subject: [PATCH 3/5] fix(travis): disable two failing platforms until they can be fixed * Every PR is currently showing as failed and `commitlint` is never running * Disable these two platforms in the meantime; still ten platforms being tested * `opensuse-423` is EOL in any case --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fa355f2..2663198 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,14 +17,14 @@ env: matrix: - INSTANCE: v2019-2-py3-debian-9 - INSTANCE: v2019-2-py3-ubuntu-1804 - - INSTANCE: v2019-2-py2-centos-7 + # - INSTANCE: v2019-2-py2-centos-7 - INSTANCE: v2019-2-py2-fedora-29 - INSTANCE: v2018-3-py2-debian-8 - INSTANCE: v2018-3-py2-ubuntu-1604 - INSTANCE: v2018-3-py2-bootstrap-centos-6 - INSTANCE: v2018-3-py2-forced-version-fedora-28 - - INSTANCE: v2018-3-py2-opensuse-423 + # - INSTANCE: v2018-3-py2-opensuse-423 - INSTANCE: v2017-7-py2-debian-8 - INSTANCE: v2017-7-py2-ubuntu-1604 From 2fe8ada616595c2be581f34663d5b7d027ce0217 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 1 Aug 2019 05:28:13 +0000 Subject: [PATCH 4/5] chore(release): 0.58.1 [skip ci] ## [0.58.1](https://github.com/saltstack-formulas/salt-formula/compare/v0.58.0...v0.58.1) (2019-08-01) ### Bug Fixes * **travis:** disable two failing platforms until they can be fixed ([5fcadcd](https://github.com/saltstack-formulas/salt-formula/commit/5fcadcd)) --- AUTHORS.md | 2 +- CHANGELOG.md | 7 +++++++ FORMULA | 2 +- docs/AUTHORS.rst | 2 +- docs/CHANGELOG.rst | 9 +++++++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 22151a4..3a6ad35 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -105,4 +105,4 @@ Avatar|Contributor|Contributions --- -Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-06-13. +Auto-generated by a [forked version](https://github.com/myii/maintainer) of [gaocegege/maintainer](https://github.com/gaocegege/maintainer) on 2019-08-01. diff --git a/CHANGELOG.md b/CHANGELOG.md index 013388c..a9ab5a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.58.1](https://github.com/saltstack-formulas/salt-formula/compare/v0.58.0...v0.58.1) (2019-08-01) + + +### Bug Fixes + +* **travis:** disable two failing platforms until they can be fixed ([5fcadcd](https://github.com/saltstack-formulas/salt-formula/commit/5fcadcd)) + # [0.58.0](https://github.com/saltstack-formulas/salt-formula/compare/v0.57.1...v0.58.0) (2019-06-13) diff --git a/FORMULA b/FORMULA index bc8b926..941acc5 100644 --- a/FORMULA +++ b/FORMULA @@ -1,7 +1,7 @@ name: salt os: Debian, Redhat, Suse, Arch, Gentoo, FreeBSD, Windows os_family: Debian, Redhat, Suse, Arch, Gentoo, FreeBSD, Windows -version: 0.58.0 +version: 0.58.1 release: 1 minimum_version: 2015.8 summary: Formula for install Saltstack diff --git a/docs/AUTHORS.rst b/docs/AUTHORS.rst index 3c1d0b4..6f7f5d2 100644 --- a/docs/AUTHORS.rst +++ b/docs/AUTHORS.rst @@ -311,4 +311,4 @@ This list is sorted by the number of commits per contributor in *descending* ord ---- -Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2019-06-13. +Auto-generated by a `forked version `_ of `gaocegege/maintainer `_ on 2019-08-01. diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 4ea63c4..d8d587c 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,15 @@ Changelog ========= +`0.58.1 `_ (2019-08-01) +--------------------------------------------------------------------------------------------------------- + +Bug Fixes +^^^^^^^^^ + + +* **travis:** disable two failing platforms until they can be fixed (\ `5fcadcd `_\ ) + `0.58.0 `_ (2019-06-13) --------------------------------------------------------------------------------------------------------- From beb0e85b0436e1f3475e351f1b23a73f1e41fc72 Mon Sep 17 00:00:00 2001 From: N Date: Thu, 1 Aug 2019 12:52:46 +0100 Subject: [PATCH 5/5] fix(perms): some os have custom user/root --- salt/defaults.yaml | 1 + salt/formulas.sls | 6 ++++++ salt/osfamilymap.yaml | 1 + 3 files changed, 8 insertions(+) diff --git a/salt/defaults.yaml b/salt/defaults.yaml index afe1420..21c3b30 100644 --- a/salt/defaults.yaml +++ b/salt/defaults.yaml @@ -3,6 +3,7 @@ salt: version: '' rootuser: root + rootgroup: root install_packages: True use_pip: False clean_config_d_dir: True diff --git a/salt/formulas.sls b/salt/formulas.sls index 7eb8be0..27b49b2 100644 --- a/salt/formulas.sls +++ b/salt/formulas.sls @@ -6,6 +6,10 @@ {%- from "salt/formulas.jinja" import formulas_git_opt with context %} {%- from "salt/formulas.jinja" import formulas_opts_for_git_latest with context %} +## from template-formula +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import salt_settings with context %} + # Loop over all formulas listed in pillar data {%- for env, entries in salt['pillar.get']('salt_formulas:list', {}).items() %} {%- for entry in entries %} @@ -31,6 +35,8 @@ {%- for key, value in salt['pillar.get']('salt_formulas:basedir_opts', {'makedirs': True}).items() %} - {{ key }}: {{ value }} + - user: {{ salt_settings.rootuser }} + - group: {{ salt_settings.rootgroup }} {%- endfor %} {%- endif %} diff --git a/salt/osfamilymap.yaml b/salt/osfamilymap.yaml index a1f5684..79f8932 100644 --- a/salt/osfamilymap.yaml +++ b/salt/osfamilymap.yaml @@ -96,6 +96,7 @@ Alpine: libgit2: libgit2 FreeBSD: + rootgroup: wheel salt_master: py27-salt salt_minion: py27-salt salt_syndic: py27-salt