From c0c119524228e30ed19f6fe8714d47b06915ff43 Mon Sep 17 00:00:00 2001 From: kartnico Date: Sat, 14 Sep 2019 21:23:59 +0200 Subject: [PATCH 1/4] feat(chocolatey): add chocolatey management support --- docs/README.rst | 18 ++++++++++++++++ packages/chocolatey.sls | 43 +++++++++++++++++++++++++++++++++++++++ packages/defaults.yaml | 6 ++++++ packages/init.sls | 1 + packages/osfamilymap.yaml | 6 ++++++ pillar.example | 11 ++++++++++ 6 files changed, 85 insertions(+) create mode 100644 packages/chocolatey.sls diff --git a/docs/README.rst b/docs/README.rst index 9505e4e..af1d9ad 100644 --- a/docs/README.rst +++ b/docs/README.rst @@ -224,6 +224,24 @@ to install, in the format: ``name: url`` + +`packages.chocolatey`` +^^^^^^^^^^^^^^^^^^^^^^ + +You can specify: + +* ``wanted`` chocolatey packages, which will be installed using chocolatey. Requires you + specify the correct ``chocolatey`` package (see the pillar.example) +* ``unwanted`` chocolatey packages, which will be uninstalled using chocolatey. +* ``required system packages`` on which any of the ``wanted`` system packages + depend for their correct installation. +* ``required states`` on which any of the ``wanted`` packages depend for their + correct installation (ie, ``regedit`` for configurations). + +.. note:: + + You must configure `winrepo-ng `_ in order to install chocolatey required package + Testing ------- diff --git a/packages/chocolatey.sls b/packages/chocolatey.sls new file mode 100644 index 0000000..07a2668 --- /dev/null +++ b/packages/chocolatey.sls @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls +{% from "packages/map.jinja" import packages with context %} + +{% set req_states = packages.chocolatey.required.states %} +{% set req_pkgs = packages.chocolatey.required.pkgs %} +{% set wanted_chocolatey = packages.chocolatey.wanted %} +{% set unwanted_chocolatey = packages.chocolatey.unwanted %} + +{% if req_states %} +include: + {% for dep in req_states %} + - {{ dep }} + {% endfor %} +{% endif %} + +chocolatey_req_pkgs: + pkg.installed: + - pkgs: {{ req_pkgs | json }} + - retry: {{ packages.retry_options|json }} + +### CHOCOLATEY PACKAGES to install +{% for choco, settings in wanted_chocolatey.items() %} +{{ choco }}: + chocolatey.installed: + - name: {{ choco }} + - version: {{ '' if 'version' not in settings else settings.version }} + - source: {{ '' if 'source' not in settings else settings.source }} + - force: {{ False if 'force' not in settings else settings.force }} + - pre_versions: {{ False if 'pre_versions' not in settings else settings.pre_versions }} + - install_args: {{ '' if 'install_args' not in settings else settings.install_args }} + - override_args: {{ False if 'override_args' not in settings else settings.override_args }} + - force_x86: {{ False if 'force_x86' not in settings else settings.force_x86 }} + - package_args: {{ '' if 'package_args' not in settings else settings.package_args }} + - allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }} +{% endfor %} + +### CHOCOLATEY PACKAGES to uninstall +{% for uchoco in unwanted_chocolatey %} +{{ uchoco }}: + chocolatey.uninstalled: + - name: {{ uchoco }} +{% endfor %} diff --git a/packages/defaults.yaml b/packages/defaults.yaml index a279106..3c95b09 100644 --- a/packages/defaults.yaml +++ b/packages/defaults.yaml @@ -25,6 +25,12 @@ packages: required: states: [] pkgs: [] + chocolatey: + wanted: [] + unwanted: [] + required: + states: [] + pkgs: [] npms: wanted: [] unwanted: [] diff --git a/packages/init.sls b/packages/init.sls index f75f23a..763e752 100644 --- a/packages/init.sls +++ b/packages/init.sls @@ -10,3 +10,4 @@ include: - packages.archives - packages.snaps - packages.golang + - packages.chocolatey diff --git a/packages/osfamilymap.yaml b/packages/osfamilymap.yaml index dff9353..91cc9a6 100644 --- a/packages/osfamilymap.yaml +++ b/packages/osfamilymap.yaml @@ -46,3 +46,9 @@ FreeBSD: pkgs: - lang/ruby25 - devel/ruby-gems + +Windows: + chocolatey: + required: + pkgs: + - chocolatey diff --git a/pillar.example b/pillar.example index 889d112..344bea8 100644 --- a/pillar.example +++ b/pillar.example @@ -62,6 +62,17 @@ packages: - kitchen-vagrant - kwalify + chocolatey: + wanted: + firefox: + install_args: "l=fr-FR" + packagename: + version: '12.04' + source: 'mychocolatey/source' + force: true + unwanted: + - googlechrome + snaps: wanted: - hello-world From 385b2238f4c8bc9389728cc6f90e320bc74b077c Mon Sep 17 00:00:00 2001 From: kartnico Date: Sun, 15 Sep 2019 12:57:12 +0200 Subject: [PATCH 2/4] fix(chocolatey): verify chocolatey dicts are not empty --- packages/chocolatey.sls | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/chocolatey.sls b/packages/chocolatey.sls index 07a2668..24d7eac 100644 --- a/packages/chocolatey.sls +++ b/packages/chocolatey.sls @@ -2,6 +2,7 @@ # vim: ft=sls {% from "packages/map.jinja" import packages with context %} +{% if packages.chocolatey %} {% set req_states = packages.chocolatey.required.states %} {% set req_pkgs = packages.chocolatey.required.pkgs %} {% set wanted_chocolatey = packages.chocolatey.wanted %} @@ -20,6 +21,7 @@ chocolatey_req_pkgs: - retry: {{ packages.retry_options|json }} ### CHOCOLATEY PACKAGES to install +{% if wanted_chocolatey %} {% for choco, settings in wanted_chocolatey.items() %} {{ choco }}: chocolatey.installed: @@ -34,10 +36,14 @@ chocolatey_req_pkgs: - package_args: {{ '' if 'package_args' not in settings else settings.package_args }} - allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }} {% endfor %} +{% endif %} ### CHOCOLATEY PACKAGES to uninstall +{% if unwanted_chocolatey %} {% for uchoco in unwanted_chocolatey %} {{ uchoco }}: chocolatey.uninstalled: - name: {{ uchoco }} {% endfor %} +{% endif %} +{% endif %} From c1d680a9dd0863497ca004dcf41378fa0e5707f9 Mon Sep 17 00:00:00 2001 From: kartnico Date: Sat, 28 Mar 2020 10:58:10 +0100 Subject: [PATCH 3/4] fix(chocolatey): ensure states only run on Windows systems --- packages/chocolatey.sls | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/chocolatey.sls b/packages/chocolatey.sls index 24d7eac..e550d06 100644 --- a/packages/chocolatey.sls +++ b/packages/chocolatey.sls @@ -2,6 +2,8 @@ # vim: ft=sls {% from "packages/map.jinja" import packages with context %} +{% if grains['os'] == 'Windows' %} + {% if packages.chocolatey %} {% set req_states = packages.chocolatey.required.states %} {% set req_pkgs = packages.chocolatey.required.pkgs %} @@ -47,3 +49,5 @@ chocolatey_req_pkgs: {% endfor %} {% endif %} {% endif %} + +{% endif %} From 070172db89f2762b11c73c8d149619ce1f197167 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Mon, 30 Mar 2020 16:49:23 +0100 Subject: [PATCH 4/4] docs(changelog): merge old changelog into the new one --- CHANGELOG.rst | 43 ------------------------------------- docs/CHANGELOG.rst | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 43 deletions(-) delete mode 100644 CHANGELOG.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst deleted file mode 100644 index ddaa4f0..0000000 --- a/CHANGELOG.rst +++ /dev/null @@ -1,43 +0,0 @@ -packages formula -================ - -0.1.0 (2019-03-10) - -- Add npm support - -0.0.9 (2018-10-03) - -- Add support for plain files using archive - -0.0.8 (2018-08-23) - -- Add archive support - -0.0.7 (2018-07-11) - -- Fix pip/gems for FreeBSD - -0.0.6 (2018-04-09) - -- Add snap with classic confinement support - -0.0.5 (2018-03-14) - -- Add snap support - -0.0.4 (2018-03-06) - -- Allow to specify held system packages also as a list (#10) - -0.0.3 (2018-03-02) - -- Allow to hold/unhold system packages (#8) - -0.0.2 (2018-02-23) - -- Add Fedora support -- Add more tests - -0.0.1 (2018-02-12) - -- Initial version diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index ea6fc3d..7438fc7 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -92,3 +92,56 @@ Tests * **pillar:** use single ubuntu pillar (\ `c69cb5a `_\ ) * **pillar:** use specific pillar for ``debian`` (\ `adf1523 `_\ ) * fix existing tests (\ `8e75c9d `_\ ) + +---- + +0.1.0 (2019-03-10) +------------------ + +* Add npm support + +0.0.9 (2018-10-03) +------------------ + +* Add support for plain files using archive + +0.0.8 (2018-08-23) +------------------ + +* Add archive support + +0.0.7 (2018-07-11) +------------------ + +* Fix pip/gems for FreeBSD + +0.0.6 (2018-04-09) +------------------ + +* Add snap with classic confinement support + +0.0.5 (2018-03-14) +------------------ + +* Add snap support + +0.0.4 (2018-03-06) +------------------ + +* Allow to specify held system packages also as a list (#10) + +0.0.3 (2018-03-02) +------------------ + +* Allow to hold/unhold system packages (#8) + +0.0.2 (2018-02-23) +------------------ + +* Add Fedora support +* Add more tests + +0.0.1 (2018-02-12) +------------------ + +* Initial version