Skip to content

Commit 9a9d3e4

Browse files
authored
Merge pull request #60 from kartnico/chocolatey
Add chocolatey management support
2 parents 5d59759 + 070172d commit 9a9d3e4

File tree

8 files changed

+148
-43
lines changed

8 files changed

+148
-43
lines changed

CHANGELOG.rst

Lines changed: 0 additions & 43 deletions
This file was deleted.

docs/CHANGELOG.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,56 @@ Tests
9292
* **pillar:** use single ubuntu pillar (\ `c69cb5a <https://github.com/saltstack-formulas/packages-formula/commit/c69cb5a792186a8a1600987087389229ddf7a67a>`_\ )
9393
* **pillar:** use specific pillar for ``debian`` (\ `adf1523 <https://github.com/saltstack-formulas/packages-formula/commit/adf1523e08bfeff8d635052a8942b48326e507cb>`_\ )
9494
* fix existing tests (\ `8e75c9d <https://github.com/saltstack-formulas/packages-formula/commit/8e75c9d5c0c4af5fe4e56ecfcdfcc7ea7486d4dc>`_\ )
95+
96+
----
97+
98+
0.1.0 (2019-03-10)
99+
------------------
100+
101+
* Add npm support
102+
103+
0.0.9 (2018-10-03)
104+
------------------
105+
106+
* Add support for plain files using archive
107+
108+
0.0.8 (2018-08-23)
109+
------------------
110+
111+
* Add archive support
112+
113+
0.0.7 (2018-07-11)
114+
------------------
115+
116+
* Fix pip/gems for FreeBSD
117+
118+
0.0.6 (2018-04-09)
119+
------------------
120+
121+
* Add snap with classic confinement support
122+
123+
0.0.5 (2018-03-14)
124+
------------------
125+
126+
* Add snap support
127+
128+
0.0.4 (2018-03-06)
129+
------------------
130+
131+
* Allow to specify held system packages also as a list (#10)
132+
133+
0.0.3 (2018-03-02)
134+
------------------
135+
136+
* Allow to hold/unhold system packages (#8)
137+
138+
0.0.2 (2018-02-23)
139+
------------------
140+
141+
* Add Fedora support
142+
* Add more tests
143+
144+
0.0.1 (2018-02-12)
145+
------------------
146+
147+
* Initial version

docs/README.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,24 @@ to install, in the format:
224224

225225
``name: url``
226226

227+
228+
`packages.chocolatey``
229+
^^^^^^^^^^^^^^^^^^^^^^
230+
231+
You can specify:
232+
233+
* ``wanted`` chocolatey packages, which will be installed using chocolatey. Requires you
234+
specify the correct ``chocolatey`` package (see the pillar.example)
235+
* ``unwanted`` chocolatey packages, which will be uninstalled using chocolatey.
236+
* ``required system packages`` on which any of the ``wanted`` system packages
237+
depend for their correct installation.
238+
* ``required states`` on which any of the ``wanted`` packages depend for their
239+
correct installation (ie, ``regedit`` for configurations).
240+
241+
.. note::
242+
243+
You must configure `winrepo-ng <https://github.com/saltstack/salt-winrepo-ng>`_ in order to install chocolatey required package
244+
227245
Testing
228246
-------
229247

packages/chocolatey.sls

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=sls
3+
{% from "packages/map.jinja" import packages with context %}
4+
5+
{% if grains['os'] == 'Windows' %}
6+
7+
{% if packages.chocolatey %}
8+
{% set req_states = packages.chocolatey.required.states %}
9+
{% set req_pkgs = packages.chocolatey.required.pkgs %}
10+
{% set wanted_chocolatey = packages.chocolatey.wanted %}
11+
{% set unwanted_chocolatey = packages.chocolatey.unwanted %}
12+
13+
{% if req_states %}
14+
include:
15+
{% for dep in req_states %}
16+
- {{ dep }}
17+
{% endfor %}
18+
{% endif %}
19+
20+
chocolatey_req_pkgs:
21+
pkg.installed:
22+
- pkgs: {{ req_pkgs | json }}
23+
- retry: {{ packages.retry_options|json }}
24+
25+
### CHOCOLATEY PACKAGES to install
26+
{% if wanted_chocolatey %}
27+
{% for choco, settings in wanted_chocolatey.items() %}
28+
{{ choco }}:
29+
chocolatey.installed:
30+
- name: {{ choco }}
31+
- version: {{ '' if 'version' not in settings else settings.version }}
32+
- source: {{ '' if 'source' not in settings else settings.source }}
33+
- force: {{ False if 'force' not in settings else settings.force }}
34+
- pre_versions: {{ False if 'pre_versions' not in settings else settings.pre_versions }}
35+
- install_args: {{ '' if 'install_args' not in settings else settings.install_args }}
36+
- override_args: {{ False if 'override_args' not in settings else settings.override_args }}
37+
- force_x86: {{ False if 'force_x86' not in settings else settings.force_x86 }}
38+
- package_args: {{ '' if 'package_args' not in settings else settings.package_args }}
39+
- allow_multiple: {{ False if 'allow_multiple' not in settings else settings.allow_multiple }}
40+
{% endfor %}
41+
{% endif %}
42+
43+
### CHOCOLATEY PACKAGES to uninstall
44+
{% if unwanted_chocolatey %}
45+
{% for uchoco in unwanted_chocolatey %}
46+
{{ uchoco }}:
47+
chocolatey.uninstalled:
48+
- name: {{ uchoco }}
49+
{% endfor %}
50+
{% endif %}
51+
{% endif %}
52+
53+
{% endif %}

packages/defaults.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ packages:
2525
required:
2626
states: []
2727
pkgs: []
28+
chocolatey:
29+
wanted: []
30+
unwanted: []
31+
required:
32+
states: []
33+
pkgs: []
2834
npms:
2935
wanted: []
3036
unwanted: []

packages/init.sls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ include:
1010
- packages.archives
1111
- packages.snaps
1212
- packages.golang
13+
- packages.chocolatey

packages/osfamilymap.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,9 @@ FreeBSD:
4646
pkgs:
4747
- lang/ruby25
4848
- devel/ruby-gems
49+
50+
Windows:
51+
chocolatey:
52+
required:
53+
pkgs:
54+
- chocolatey

pillar.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,17 @@ packages:
6262
- kitchen-vagrant
6363
- kwalify
6464

65+
chocolatey:
66+
wanted:
67+
firefox:
68+
install_args: "l=fr-FR"
69+
packagename:
70+
version: '12.04'
71+
source: 'mychocolatey/source'
72+
force: true
73+
unwanted:
74+
- googlechrome
75+
6576
snaps:
6677
wanted:
6778
- hello-world

0 commit comments

Comments
 (0)