100
100
type: bool
101
101
default: false
102
102
version_added: 1.3.0
103
+ use_globs:
104
+ description:
105
+ - Treat the package names as shell glob patterns.
106
+ required: false
107
+ type: bool
108
+ default: true
109
+ version_added: 9.3.0
103
110
author: "bleader (@bleader)"
104
111
notes:
105
112
- When using pkgsite, be careful that already in cache packages won't be downloaded again.
136
143
community.general.pkgng:
137
144
name: "*"
138
145
state: latest
146
+
147
+ - name: Upgrade foo/bar
148
+ community.general.pkgng:
149
+ name: foo/bar
150
+ state: latest
151
+ use_globs: false
139
152
'''
140
153
141
154
146
159
147
160
def query_package (module , run_pkgng , name ):
148
161
149
- rc , out , err = run_pkgng ('info' , '-g' , '- e' , name )
162
+ rc , out , err = run_pkgng ('info' , '-e' , name )
150
163
151
164
return rc == 0
152
165
@@ -156,7 +169,7 @@ def query_update(module, run_pkgng, name):
156
169
# Check to see if a package upgrade is available.
157
170
# rc = 0, no updates available or package not installed
158
171
# rc = 1, updates available
159
- rc , out , err = run_pkgng ('upgrade' , '-g' , '- n' , name )
172
+ rc , out , err = run_pkgng ('upgrade' , '-n' , name )
160
173
161
174
return rc == 1
162
175
@@ -259,7 +272,7 @@ def install_packages(module, run_pkgng, packages, cached, state):
259
272
action_count [action ] += len (package_list )
260
273
continue
261
274
262
- pkgng_args = [action , '-g' , '- U' , '-y' ] + package_list
275
+ pkgng_args = [action , '-U' , '-y' ] + package_list
263
276
rc , out , err = run_pkgng (* pkgng_args )
264
277
stdout += out
265
278
stderr += err
@@ -289,7 +302,7 @@ def install_packages(module, run_pkgng, packages, cached, state):
289
302
290
303
291
304
def annotation_query (module , run_pkgng , package , tag ):
292
- rc , out , err = run_pkgng ('info' , '-g' , '- A' , package )
305
+ rc , out , err = run_pkgng ('info' , '-A' , package )
293
306
match = re .search (r'^\s*(?P<tag>%s)\s*:\s*(?P<value>\w+)' % tag , out , flags = re .MULTILINE )
294
307
if match :
295
308
return match .group ('value' )
@@ -424,7 +437,9 @@ def main():
424
437
rootdir = dict (required = False , type = 'path' ),
425
438
chroot = dict (required = False , type = 'path' ),
426
439
jail = dict (required = False , type = 'str' ),
427
- autoremove = dict (default = False , type = 'bool' )),
440
+ autoremove = dict (default = False , type = 'bool' ),
441
+ use_globs = dict (default = True , required = False , type = 'bool' ),
442
+ ),
428
443
supports_check_mode = True ,
429
444
mutually_exclusive = [["rootdir" , "chroot" , "jail" ]])
430
445
@@ -465,6 +480,9 @@ def main():
465
480
def run_pkgng (action , * args , ** kwargs ):
466
481
cmd = [pkgng_path , dir_arg , action ]
467
482
483
+ if p ["use_globs" ] and action in ('info' , 'install' , 'upgrade' ,):
484
+ args = ('-g' ,) + args
485
+
468
486
pkgng_env = {'BATCH' : 'yes' }
469
487
470
488
if p ["ignore_osver" ]:
0 commit comments