Line 0
Link Here
|
|
|
1 |
--- salt/modules/pkgng.py.orig 2017-10-09 16:37:42 UTC |
2 |
+++ salt/modules/pkgng.py |
3 |
@@ -1154,8 +1154,6 @@ def upgrade(*names, **kwargs): |
4 |
opts += 'n' |
5 |
if not dryrun: |
6 |
opts += 'y' |
7 |
- if opts: |
8 |
- opts = '-' + opts |
9 |
|
10 |
cmd = _pkg(jail, chroot, root) |
11 |
cmd.append('upgrade') |
12 |
@@ -1181,7 +1179,11 @@ def upgrade(*names, **kwargs): |
13 |
return ret |
14 |
|
15 |
|
16 |
-def clean(jail=None, chroot=None, root=None): |
17 |
+def clean(jail=None, |
18 |
+ chroot=None, |
19 |
+ root=None, |
20 |
+ clean_all=False, |
21 |
+ dryrun=False): |
22 |
''' |
23 |
Cleans the local cache of fetched remote packages |
24 |
|
25 |
@@ -1190,11 +1192,64 @@ def clean(jail=None, chroot=None, root=None): |
26 |
.. code-block:: bash |
27 |
|
28 |
salt '*' pkg.clean |
29 |
- salt '*' pkg.clean jail=<jail name or id> |
30 |
- salt '*' pkg.clean chroot=/path/to/chroot |
31 |
+ |
32 |
+ jail |
33 |
+ Cleans the package cache in the specified jail |
34 |
+ |
35 |
+ CLI Example: |
36 |
+ |
37 |
+ .. code-block:: bash |
38 |
+ |
39 |
+ salt '*' pkg.clean jail=<jail name or id> |
40 |
+ |
41 |
+ chroot |
42 |
+ Cleans the package cache in the specified chroot (ignored if ``jail`` |
43 |
+ is specified) |
44 |
+ |
45 |
+ root |
46 |
+ Cleans the package cache in the specified root (ignored if ``jail`` |
47 |
+ is specified) |
48 |
+ |
49 |
+ CLI Example: |
50 |
+ |
51 |
+ .. code-block:: bash |
52 |
+ |
53 |
+ salt '*' pkg.clean chroot=/path/to/chroot |
54 |
+ |
55 |
+ clean_all |
56 |
+ Clean all packages from the local cache (not just those that have been |
57 |
+ superseded by newer versions). |
58 |
+ |
59 |
+ CLI Example: |
60 |
+ |
61 |
+ .. code-block:: bash |
62 |
+ |
63 |
+ salt '*' pkg.clean clean_all=True |
64 |
+ |
65 |
+ dryrun |
66 |
+ Dry-run mode. This list of changes to the local cache is always |
67 |
+ printed, but no changes are actually made. |
68 |
+ |
69 |
+ CLI Example: |
70 |
+ |
71 |
+ .. code-block:: bash |
72 |
+ |
73 |
+ salt '*' pkg.clean dryrun=True |
74 |
''' |
75 |
+ opts = '' |
76 |
+ if clean_all: |
77 |
+ opts += 'a' |
78 |
+ if dryrun: |
79 |
+ opts += 'n' |
80 |
+ else: |
81 |
+ opts += 'y' |
82 |
+ |
83 |
+ cmd = _pkg(jail, chroot, root) |
84 |
+ cmd.append('clean') |
85 |
+ if opts: |
86 |
+ cmd.append('-' + opts) |
87 |
return __salt__['cmd.run']( |
88 |
- _pkg(jail, chroot, root) + ['clean'], |
89 |
+ cmd, |
90 |
output_loglevel='trace', |
91 |
python_shell=False |
92 |
) |