depot3 3.0.15 → 3.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,441 +22,453 @@
22
22
  ###
23
23
  ###
24
24
 
25
-
26
25
  ###
27
26
  module D3
28
27
  module Admin
29
28
 
30
- # all the available actions
31
- ACTIONS = %w{ add edit live delete info search report config help }
32
-
33
- # these actions write to the server and
34
- # need a legit admin, not one
35
- # listed in D3.badmins.
36
- #
37
- ACTIONS_NEEDING_ADMIN = %w{ add edit live delete }
38
-
39
- # the possible targets to config
40
- CONFIG_TARGETS = %w{all jss db dist workspace pkg-id-prefix}
29
+ # all the available actions
30
+ ACTIONS = %w(add edit live delete info search report config help).freeze
41
31
 
32
+ # these actions write to the server and
33
+ # need a legit admin, not one
34
+ # listed in D3.badmins.
35
+ #
36
+ ACTIONS_NEEDING_ADMIN = %w(add edit live delete).freeze
42
37
 
43
- TRUE_VALUES = [true, /^true$/i, 1, /^y(es)?$/i]
44
- FALSE_VALUES = [false, /^false$/i, nil, 0, /^no?$/i]
38
+ # the possible targets to config
39
+ CONFIG_TARGETS = %w(all jss db dist workspace pkg-id-prefix editor).freeze
45
40
 
46
- DFT_REQUIRED = "---Required---"
47
- DFT_NONE = "none"
48
- DFT_PKG_TYPE = :pkg
49
- DFT_PKG_ID_PREFIX = "d3"
50
- DFT_WORKSPACE = ENV['HOME']
51
- DFT_EXPIRATION = 0
52
- DFT_LIST_TYPE = :all
41
+ TRUE_VALUES = [true, /^true$/i, 1, /^y(es)?$/i].freeze
42
+ FALSE_VALUES = [false, /^false$/i, nil, 0, /^no?$/i].freeze
53
43
 
44
+ DFT_REQUIRED = '---Required---'.freeze
45
+ DFT_NONE = 'none'.freeze
46
+ DFT_PKG_TYPE = :pkg
47
+ DFT_PKG_ID_PREFIX = 'd3'.freeze
48
+ DFT_WORKSPACE = ENV['HOME']
49
+ DFT_EXPIRATION = 0
50
+ DFT_LIST_TYPE = :all
54
51
 
52
+ DISPLAY_TRUE_FALSE = proc { |v| case v; when *TRUE_VALUES then 'true'; when *FALSE_VALUES then 'false'; else 'unknown'; end }
53
+ DISPLAY_DFT_REQUIRED = proc { |v| v.to_s.empty? ? DFT_REQUIRED : v }
54
+ DISPLAY_DFT_NONE = proc { |v| v.to_s.empty? ? DFT_NONE : v }
55
+ DISPLAY_COMMA_SEP_LIST = proc { |v| DISPLAY_DFT_NONE.call JSS.to_s_and_a(v)[:stringform] }
56
+ DISPLAY_PKG_TYPE = proc { |v| v.to_s.start_with?('d') ? 'dmg' : 'pkg' }
57
+ DISPLAY_LIST_TYPE = proc { |v| v.to_s.empty? ? DFT_LIST_TYPE : v }
55
58
 
56
- DISPLAY_TRUE_FALSE = Proc.new {|v| case v ; when *TRUE_VALUES then "true"; when *FALSE_VALUES then "false"; else "unknown" ; end }
57
- DISPLAY_DFT_REQUIRED = Proc.new {|v| v.to_s.empty? ? DFT_REQUIRED : v }
58
- DISPLAY_DFT_NONE = Proc.new{|v| v.to_s.empty? ? DFT_NONE : v }
59
- DISPLAY_COMMA_SEP_LIST = Proc.new{|v| DISPLAY_DFT_NONE.call JSS.to_s_and_a(v)[:stringform] }
60
- DISPLAY_PKG_TYPE = Proc.new{|v| v.to_s.start_with?('d') ? 'dmg' : 'pkg' }
61
- DISPLAY_LIST_TYPE = Proc.new{|v| v.to_s.empty? ? DFT_LIST_TYPE : v }
59
+ # This hash provides details about how to handle all possible CLI option
60
+ # values for d3admin, be they input from the command-line or via a walkthru
61
+ #
62
+ # Each key matches a key/method in the @options OpenStruct in d3admin.
63
+ # representing the value for that option from the commandline.
64
+ #
65
+ # For each one, there is a sub-hash defining these things:
66
+ #
67
+ # :default: The global default value, before applying any
68
+ # inherited values from older pkgs, or user-specified values
69
+ # from the commandline or walkthru. Note these are the Ruby internal
70
+ # default values (e.g. nil) NOT the cli option default values
71
+ # (e.g. 'n') which are defined in the d3admins parse_cli method.
72
+ #
73
+ # :cli: the GetoptLong array for this commandline option
74
+ #
75
+ # :label: The lable for the value when when prompting for input
76
+ # or showing formatted details of the pkg.
77
+ #
78
+ # :display_conversion: A proc that converts the internally-used form of a value
79
+ # to something more human-readable
80
+ # (e.g. "none" instead of an empty string for a nil value)
81
+ #
82
+ # :get: the get_ method from D3::Admin::Interactive that is used to prompt for
83
+ # a new value for the attribute.
84
+ #
85
+ # :unsetable: This option can take "none" or "n" to set its value to nil
86
+ #
87
+ # :validate: the method from D3::Admin::Validate used to validate the
88
+ # value being provided and convert it to its internally-used form
89
+ #
90
+ #
91
+ OPTIONS = {
62
92
 
63
- # This hash provides details about how to handle all possible CLI option
64
- # values for d3admin, be they input from the command-line or via a walkthru
65
- #
66
- # Each key matches a key/method in the @options OpenStruct in d3admin.
67
- # representing the value for that option from the commandline.
68
- #
69
- # For each one, there is a sub-hash defining these things:
70
- #
71
- # :default => The global default value, before applying any
72
- # inherited values from older pkgs, or user-specified values
73
- # from the commandline or walkthru. Note these are the Ruby internal
74
- # default values (e.g. nil) NOT the cli option default values
75
- # (e.g. 'n') which are defined in the d3admins parse_cli method.
76
- #
77
- # :cli => the GetoptLong array for this commandline option
78
- #
79
- # :label => The lable for the value when when prompting for input
80
- # or showing formatted details of the pkg.
81
- #
82
- # :display_conversion => A proc that converts the internally-used form of a value
83
- # to something more human-readable
84
- # (e.g. "none" instead of an empty string for a nil value)
85
- #
86
- # :get => the get_ method from D3::Admin::Interactive that is used to prompt for
87
- # a new value for the attribute.
88
- #
89
- # :unsetable => This option can take "none" or "n" to set its value to nil
90
- #
91
- # :validate => the method from D3::Admin::Validate used to validate the
92
- # value being provided and convert it to its internally-used form
93
- #
94
- #
95
- OPTIONS = {
93
+ # General
94
+ help: {
95
+ default: nil,
96
+ cli: ['--help', '-h', GetoptLong::NO_ARGUMENT],
97
+ label: 'View help',
98
+ display_conversion: DISPLAY_TRUE_FALSE,
99
+ get: nil,
100
+ validate: nil
101
+ },
102
+ extended_help: {
103
+ default: nil,
104
+ cli: ['--extended-help', '-H', GetoptLong::NO_ARGUMENT],
105
+ label: 'View extended help',
106
+ display_conversion: DISPLAY_TRUE_FALSE,
107
+ get: nil,
108
+ validate: nil
109
+ },
110
+ walkthru: {
111
+ default: nil,
112
+ cli: ['--walkthru', '-w', GetoptLong::NO_ARGUMENT],
113
+ label: 'Walk-through',
114
+ display_conversion: DISPLAY_TRUE_FALSE,
115
+ get: nil,
116
+ validate: nil
117
+ },
118
+ auto_confirm: {
119
+ default: nil,
120
+ cli: ['--auto-confirm', '-a', GetoptLong::NO_ARGUMENT],
121
+ label: 'Auto-confirm',
122
+ display_conversion: DISPLAY_TRUE_FALSE,
123
+ get: nil,
124
+ validate: nil
125
+ },
126
+ admin: {
127
+ cli: ['--admin', GetoptLong::REQUIRED_ARGUMENT],
128
+ arg: 'admin',
129
+ help: 'who is doing something with d3?'
130
+ },
96
131
 
97
- # General
98
- help: {
99
- :default => nil,
100
- :cli => [ '--help', "-h", GetoptLong::NO_ARGUMENT ],
101
- :label => "View help",
102
- :display_conversion => DISPLAY_TRUE_FALSE,
103
- :get => nil,
104
- :validate => nil
105
- },
106
- extended_help: {
107
- :default => nil,
108
- :cli => [ '--extended-help','-H', GetoptLong::NO_ARGUMENT ],
109
- :label => "View extended help",
110
- :display_conversion => DISPLAY_TRUE_FALSE,
111
- :get => nil,
112
- :validate => nil
113
- },
114
- walkthru: {
115
- :default => nil,
116
- :cli => [ '--walkthru','-w', GetoptLong::NO_ARGUMENT ],
117
- :label => "Walk-through",
118
- :display_conversion => DISPLAY_TRUE_FALSE,
119
- :get => nil,
120
- :validate => nil
121
- },
122
- auto_confirm: {
123
- :default => nil,
124
- :cli => [ '--auto-confirm','-a', GetoptLong::NO_ARGUMENT ],
125
- :label => "Auto-confirm",
126
- :display_conversion => DISPLAY_TRUE_FALSE,
127
- :get => nil,
128
- :validate => nil
129
- },
130
- admin: {
131
- :cli => ['--admin', GetoptLong::REQUIRED_ARGUMENT ],
132
- :arg => 'admin',
133
- :help => "who is doing something with d3?"
134
- },
132
+ # Package Identification: Add/Edit/Info/Delete
135
133
 
136
- # Package Identification: Add/Edit/Info/Delete
134
+ package_name: {
135
+ default: nil,
136
+ cli: ['--package-name', '-n', GetoptLong::REQUIRED_ARGUMENT],
137
+ label: 'JSS Package Name',
138
+ display_conversion: nil,
139
+ get: :get_package_name,
140
+ validate: :validate_package_name
141
+ },
142
+ filename: {
143
+ default: nil,
144
+ cli: ['--filename', '-f', GetoptLong::REQUIRED_ARGUMENT],
145
+ label: 'Dist. Point Filename',
146
+ display_conversion: nil,
147
+ get: :get_filename,
148
+ validate: :validate_filename
149
+ },
137
150
 
138
- package_name: {
139
- :default => nil,
140
- :cli => [ '--package-name', '-n', GetoptLong::REQUIRED_ARGUMENT ],
141
- :label => "JSS Package Name",
142
- :display_conversion => nil,
143
- :get => :get_package_name,
144
- :validate => :validate_package_name
145
- },
146
- filename: {
147
- :default => nil,
148
- :cli => [ '--filename', '-f', GetoptLong::REQUIRED_ARGUMENT ],
149
- :label => "Dist. Point Filename",
150
- :display_conversion => nil,
151
- :get => :get_filename,
152
- :validate => :validate_filename
153
- },
151
+ # Add
152
+ import: {
153
+ default: nil,
154
+ cli: ['--import', '-i', GetoptLong::OPTIONAL_ARGUMENT],
155
+ label: 'Import existing JSS package',
156
+ display_conversion: nil,
157
+ get: :get_jss_package_for_import,
158
+ validate: :validate_package_for_import
159
+ },
160
+ no_inherit: {
161
+ default: nil,
162
+ cli: ['--no-inherit', '-I', GetoptLong::NO_ARGUMENT],
163
+ label: 'Do not inherit from older pacakge',
164
+ display_conversion: DISPLAY_TRUE_FALSE,
165
+ get: nil,
166
+ validate: nil
167
+ },
168
+ source_path: {
169
+ default: nil,
170
+ cli: ['--source-path', '-s', GetoptLong::REQUIRED_ARGUMENT],
171
+ label: 'Source path',
172
+ display_conversion: DISPLAY_DFT_REQUIRED,
173
+ get: :get_source_path,
174
+ validate: :validate_source_path
175
+ },
176
+ package_build_type: {
177
+ default: DFT_PKG_TYPE,
178
+ cli: ['--dmg', GetoptLong::NO_ARGUMENT],
179
+ label: 'Package build type',
180
+ display_conversion: DISPLAY_PKG_TYPE,
181
+ get: :get_package_build_type,
182
+ validate: :validate_package_build_type
183
+ },
184
+ signing_identity: {
185
+ default: nil,
186
+ cli: ['--signing-id', GetoptLong::NO_ARGUMENT],
187
+ label: 'Package signing identity',
188
+ display_conversion: nil,
189
+ get: :get_signing_identity,
190
+ validate: :validate_signing_idenitity
191
+ },
192
+ signing_options: {
193
+ default: nil,
194
+ cli: ['--signing-opts', GetoptLong::NO_ARGUMENT],
195
+ label: 'Signing arguments and options',
196
+ display_conversion: nil,
197
+ get: :get_signing_options,
198
+ validate: :validate_signing_options
199
+ },
200
+ pkg_preserve_owners: {
201
+ default: nil,
202
+ cli: ['--preserve-owners', GetoptLong::NO_ARGUMENT],
203
+ label: 'Preserve ownership in .pkg',
204
+ display_conversion: DISPLAY_TRUE_FALSE,
205
+ get: :get_pkg_preserve_owners,
206
+ validate: :validate_yes_no
207
+ },
208
+ pkg_identifier: {
209
+ default: nil,
210
+ cli: ['--pkg-id', '-p', GetoptLong::REQUIRED_ARGUMENT],
211
+ label: 'Package identifier prefix',
212
+ display_conversion: nil,
213
+ get: :get_pkg_identifier,
214
+ validate: :validate_package_identifier
215
+ },
216
+ workspace: {
217
+ default: DFT_WORKSPACE,
218
+ cli: ['--workspace', '-W', GetoptLong::REQUIRED_ARGUMENT],
219
+ label: 'Package build workspace',
220
+ display_conversion: nil,
221
+ get: :get_workspace,
222
+ validate: :validate_workspace
223
+ },
154
224
 
155
- # Add
225
+ # Add/Edit
226
+ version: {
227
+ default: '1',
228
+ cli: ['--version', '-v', GetoptLong::REQUIRED_ARGUMENT],
229
+ label: 'Version',
230
+ display_conversion: DISPLAY_DFT_REQUIRED,
231
+ get: :get_version,
232
+ validate: :validate_version
233
+ },
234
+ revision: {
235
+ default: 1,
236
+ cli: ['--revision', '-r', GetoptLong::REQUIRED_ARGUMENT],
237
+ label: 'Revision',
238
+ display_conversion: DISPLAY_DFT_REQUIRED,
239
+ get: :get_revision,
240
+ validate: :validate_revision
241
+ },
242
+ category: {
243
+ default: D3::CONFIG.jss_default_pkg_category,
244
+ cli: ['--category', '-C', GetoptLong::REQUIRED_ARGUMENT],
245
+ label: 'Category',
246
+ display_conversion: nil,
247
+ get: :get_category,
248
+ unsetable: true,
249
+ validate: :validate_category
250
+ },
251
+ oses: {
252
+ default: nil,
253
+ cli: ['--oses', '-o', GetoptLong::REQUIRED_ARGUMENT],
254
+ label: 'Limited to OSes',
255
+ display_conversion: DISPLAY_COMMA_SEP_LIST,
256
+ get: :get_oses,
257
+ unsetable: true,
258
+ validate: :validate_oses
259
+ },
260
+ cpu_type: {
261
+ default: nil,
262
+ cli: ['--cpu_type', '-c', GetoptLong::REQUIRED_ARGUMENT],
263
+ label: 'Limited to CPU type',
264
+ display_conversion: DISPLAY_DFT_NONE,
265
+ get: :get_cpu_type,
266
+ unsetable: true,
267
+ validate: :validate_cpu_type
268
+ },
269
+ reboot: {
270
+ default: false,
271
+ cli: ['--reboot', '-R', GetoptLong::OPTIONAL_ARGUMENT],
272
+ label: 'Needs Reboot',
273
+ display_conversion: DISPLAY_TRUE_FALSE,
274
+ get: :get_reboot,
275
+ validate: :validate_yes_no
276
+ },
277
+ removable: {
278
+ default: true,
279
+ cli: ['--removable', '-u', GetoptLong::OPTIONAL_ARGUMENT],
280
+ label: 'Uninstallable',
281
+ display_conversion: DISPLAY_TRUE_FALSE,
282
+ get: :get_removable,
283
+ validate: :validate_yes_no
284
+ },
285
+ remove_first: {
286
+ default: false,
287
+ cli: ['--remove-first', '-F', GetoptLong::OPTIONAL_ARGUMENT],
288
+ label: 'Uninstalls older installs',
289
+ display_conversion: DISPLAY_TRUE_FALSE,
290
+ get: :get_remove_first,
291
+ validate: :validate_yes_no
292
+ },
293
+ prohibiting_processes: {
294
+ default: nil,
295
+ cli: ['--prohibiting-processes', '--prohibiting-process', '-x', GetoptLong::REQUIRED_ARGUMENT],
296
+ label: 'Installation prohibited by processes matching',
297
+ display_conversion: DISPLAY_COMMA_SEP_LIST,
298
+ get: :get_prohibiting_processes,
299
+ unsetable: true,
300
+ validate: :validate_prohibiting_processes,
301
+ compare: proc { |o, n| o.to_a.sort == n.to_a.sort }
302
+ },
303
+ auto_groups: {
304
+ default: nil,
305
+ cli: ['--auto-groups', '-g', GetoptLong::REQUIRED_ARGUMENT],
306
+ label: 'Auto installed for groups',
307
+ display_conversion: DISPLAY_COMMA_SEP_LIST,
308
+ get: :get_auto_groups,
309
+ validate: :validate_auto_groups,
310
+ unsetable: true,
311
+ compare: proc { |o, n| o.to_a.sort == n.to_a.sort }
312
+ },
313
+ excluded_groups: {
314
+ default: nil,
315
+ cli: ['--excluded-groups', '-G', GetoptLong::REQUIRED_ARGUMENT],
316
+ label: 'Excluded for groups',
317
+ display_conversion: DISPLAY_COMMA_SEP_LIST,
318
+ get: :get_excluded_groups,
319
+ validate: :validate_excluded_groups,
320
+ unsetable: true,
321
+ compare: proc { |o, n| o.to_a.sort == n.to_a.sort }
322
+ },
323
+ pre_install: {
324
+ default: nil,
325
+ cli: ['--pre-install', '-e', GetoptLong::REQUIRED_ARGUMENT],
326
+ label: 'Pre-install script',
327
+ display_conversion: DISPLAY_DFT_NONE,
328
+ get: :get_pre_install_script,
329
+ unsetable: true,
330
+ validate: :validate_pre_install_script
331
+ },
332
+ post_install: {
333
+ default: nil,
334
+ cli: ['--post-install', '-t', GetoptLong::REQUIRED_ARGUMENT],
335
+ label: 'Post-install script',
336
+ display_conversion: DISPLAY_DFT_NONE,
337
+ get: :get_post_install_script,
338
+ unsetable: true,
339
+ validate: :validate_post_install_script
340
+ },
341
+ pre_remove: {
342
+ default: nil,
343
+ cli: ['--pre-remove', '-E', GetoptLong::REQUIRED_ARGUMENT],
344
+ label: 'Pre-uninstall script',
345
+ display_conversion: DISPLAY_DFT_NONE,
346
+ get: :get_pre_remove_script,
347
+ unsetable: true,
348
+ validate: :validate_pre_remove_script
349
+ },
350
+ post_remove: {
351
+ default: nil,
352
+ cli: ['--post-remove', '-T', GetoptLong::REQUIRED_ARGUMENT],
353
+ label: 'Post-uninstall script',
354
+ display_conversion: DISPLAY_DFT_NONE,
355
+ get: :get_post_remove_script,
356
+ unsetable: true,
357
+ validate: :validate_post_remove_script
358
+ },
359
+ expiration: {
360
+ default: DFT_EXPIRATION,
361
+ cli: ['--expiration', '-X', GetoptLong::REQUIRED_ARGUMENT],
362
+ label: 'Expiration',
363
+ display_conversion: nil,
364
+ get: :get_expiration,
365
+ unsetable: true,
366
+ validate: :validate_expiration
367
+ },
368
+ expiration_paths: {
369
+ default: nil,
370
+ cli: ['--expiration-path', '--expiration-paths', '-P', GetoptLong::REQUIRED_ARGUMENT],
371
+ label: 'Expiration Path(s)',
372
+ display_conversion: D3::Database::ARRAY_OF_PATHNAMES_TO_COMMA_STRING,
373
+ get: :get_expiration_paths,
374
+ unsetable: true,
375
+ validate: :validate_expiration_paths,
376
+ compare: proc { |o, n| o.to_a.sort == n.to_a.sort }
377
+ },
378
+ description: {
379
+ default: '',
380
+ cli: ['--description', '-d', GetoptLong::REQUIRED_ARGUMENT],
381
+ label: 'Description',
382
+ display_conversion: proc { |v| "\n----\n#{v.to_s.gsub("\r", "\n")}\n----" },
383
+ get: :get_description,
384
+ unsetable: true,
385
+ validate: nil
386
+ },
156
387
 
157
- import: {
158
- :default => nil,
159
- :cli => [ '--import', "-i", GetoptLong::OPTIONAL_ARGUMENT ],
160
- :label => "Import existing JSS package",
161
- :display_conversion => nil,
162
- :get => :get_jss_package_for_import,
163
- :validate => :validate_package_for_import
164
- },
165
- no_inherit: {
166
- :default => nil,
167
- :cli => [ '--no-inherit', "-I", GetoptLong::NO_ARGUMENT ],
168
- :label => "Do not inherit from older pacakge",
169
- :display_conversion => DISPLAY_TRUE_FALSE,
170
- :get => nil,
171
- :validate => nil
172
- },
173
- source_path: {
174
- :default => nil,
175
- :cli => [ '--source-path', '-s', GetoptLong::REQUIRED_ARGUMENT ],
176
- :label => "Source path",
177
- :display_conversion => DISPLAY_DFT_REQUIRED,
178
- :get => :get_source_path,
179
- :validate => :validate_source_path
180
- },
181
- package_build_type: {
182
- :default => DFT_PKG_TYPE,
183
- :cli => [ '--dmg', GetoptLong::NO_ARGUMENT ],
184
- :label => "Package build type",
185
- :display_conversion => DISPLAY_PKG_TYPE,
186
- :get => :get_package_build_type,
187
- :validate => :validate_package_build_type
188
- },
189
- pkg_preserve_owners: {
190
- :default => nil,
191
- :cli => [ '--preserve-owners', GetoptLong::NO_ARGUMENT ],
192
- :label => "Preserve ownership in .pkg",
193
- :display_conversion => DISPLAY_TRUE_FALSE,
194
- :get => :get_pkg_preserve_owners,
195
- :validate => :validate_yes_no
196
- },
197
- pkg_identifier: {
198
- :default => nil,
199
- :cli => [ '--pkg-id', '-p', GetoptLong::REQUIRED_ARGUMENT ],
200
- :label => "Package identifier prefix",
201
- :display_conversion => nil,
202
- :get => :get_pkg_identifier,
203
- :validate => :validate_package_identifier
204
- },
205
- workspace: {
206
- :default => DFT_WORKSPACE,
207
- :cli => [ '--workspace', '-W', GetoptLong::REQUIRED_ARGUMENT ],
208
- :label => "Package build workspace",
209
- :display_conversion => nil,
210
- :get => :get_workspace,
211
- :validate => :validate_workspace
212
- },
388
+ # Search and Report
389
+ status: {
390
+ default: nil,
391
+ cli: ['--status', '-S', GetoptLong::REQUIRED_ARGUMENT],
392
+ label: 'Status for search and report',
393
+ display_conversion: DISPLAY_LIST_TYPE,
394
+ get: :get_scoped_groups,
395
+ validate: :validate_scoped_groups
396
+ },
213
397
 
214
- # Add/Edit
215
- version: {
216
- :default => "1",
217
- :cli => [ '--version', '-v', GetoptLong::REQUIRED_ARGUMENT ],
218
- :label => "Version",
219
- :display_conversion => DISPLAY_DFT_REQUIRED,
220
- :get => :get_version,
221
- :validate => :validate_version
222
- },
223
- revision: {
224
- :default => 1,
225
- :cli => [ '--revision', '-r', GetoptLong::REQUIRED_ARGUMENT ],
226
- :label => "Revision",
227
- :display_conversion => DISPLAY_DFT_REQUIRED,
228
- :get => :get_revision,
229
- :validate => :validate_revision
230
- },
231
- category: {
232
- :default => D3::CONFIG.jss_default_pkg_category,
233
- :cli => [ '--category', '-C', GetoptLong::REQUIRED_ARGUMENT ],
234
- :label => "Category",
235
- :display_conversion => nil,
236
- :get => :get_category,
237
- :unsetable => true,
238
- :validate => :validate_category
239
- },
240
- oses: {
241
- :default => nil,
242
- :cli => [ '--oses', '-o', GetoptLong::REQUIRED_ARGUMENT ],
243
- :label => "Limited to OS's",
244
- :display_conversion => DISPLAY_COMMA_SEP_LIST,
245
- :get => :get_oses,
246
- :unsetable => true,
247
- :validate => :validate_oses
248
- },
249
- cpu_type: {
250
- :default => nil,
251
- :cli => [ '--cpu_type', '-c', GetoptLong::REQUIRED_ARGUMENT ],
252
- :label => "Limited to CPU type",
253
- :display_conversion => DISPLAY_DFT_NONE,
254
- :get => :get_cpu_type,
255
- :unsetable => true,
256
- :validate => :validate_cpu_type
257
- },
258
- reboot: {
259
- :default => false,
260
- :cli => [ '--reboot', '-R', GetoptLong::OPTIONAL_ARGUMENT ],
261
- :label => "Needs Reboot",
262
- :display_conversion => DISPLAY_TRUE_FALSE,
263
- :get => :get_reboot,
264
- :validate => :validate_yes_no
265
- },
266
- removable: {
267
- :default => true,
268
- :cli => [ '--removable', '-u', GetoptLong::OPTIONAL_ARGUMENT ],
269
- :label => "Uninstallable",
270
- :display_conversion => DISPLAY_TRUE_FALSE,
271
- :get => :get_removable,
272
- :validate => :validate_yes_no
273
- },
274
- remove_first: {
275
- :default => false,
276
- :cli => [ '--remove-first', '-F', GetoptLong::OPTIONAL_ARGUMENT ],
277
- :label => "Uninstalls older installs",
278
- :display_conversion => DISPLAY_TRUE_FALSE,
279
- :get => :get_remove_first,
280
- :validate => :validate_yes_no
281
- },
282
- prohibiting_processes: {
283
- :default => nil,
284
- :cli => [ '--prohibiting-processes', '--prohibiting-process', '-x', GetoptLong::REQUIRED_ARGUMENT ],
285
- :label => "Installation prohibited by processes matching",
286
- :display_conversion => DISPLAY_COMMA_SEP_LIST,
287
- :get => :get_prohibiting_processes,
288
- :unsetable => true,
289
- :validate => :validate_prohibiting_processes,
290
- :compare => Proc.new{|o,n| o.to_a.sort == n.to_a.sort}
291
- },
292
- auto_groups: {
293
- :default => nil,
294
- :cli => [ '--auto-groups', '-g', GetoptLong::REQUIRED_ARGUMENT ],
295
- :label => "Auto installed for groups",
296
- :display_conversion => DISPLAY_COMMA_SEP_LIST,
297
- :get => :get_auto_groups,
298
- :validate => :validate_auto_groups,
299
- :unsetable => true,
300
- :compare => Proc.new{|o,n| o.to_a.sort == n.to_a.sort}
301
- },
302
- excluded_groups: {
303
- :default => nil,
304
- :cli => [ '--excluded-groups', '-G', GetoptLong::REQUIRED_ARGUMENT ],
305
- :label => "Excluded for groups",
306
- :display_conversion => DISPLAY_COMMA_SEP_LIST,
307
- :get => :get_excluded_groups,
308
- :validate => :validate_excluded_groups,
309
- :unsetable => true,
310
- :compare => Proc.new{|o,n| o.to_a.sort == n.to_a.sort}
311
- },
312
- pre_install: {
313
- :default => nil,
314
- :cli => [ '--pre-install', '-e', GetoptLong::REQUIRED_ARGUMENT ],
315
- :label => "Pre-install script",
316
- :display_conversion => DISPLAY_DFT_NONE,
317
- :get => :get_pre_install_script,
318
- :unsetable => true,
319
- :validate => :validate_pre_install_script
320
- },
321
- post_install: {
322
- :default => nil,
323
- :cli => [ '--post-install', '-t', GetoptLong::REQUIRED_ARGUMENT ],
324
- :label => "Post-install script",
325
- :display_conversion => DISPLAY_DFT_NONE,
326
- :get => :get_post_install_script,
327
- :unsetable => true,
328
- :validate => :validate_post_install_script
329
- },
330
- pre_remove: {
331
- :default => nil,
332
- :cli => [ '--pre-remove', '-E', GetoptLong::REQUIRED_ARGUMENT ],
333
- :label => "Pre-uninstall script",
334
- :display_conversion => DISPLAY_DFT_NONE,
335
- :get => :get_pre_remove_script,
336
- :unsetable => true,
337
- :validate => :validate_pre_remove_script
338
- },
339
- post_remove: {
340
- :default => nil,
341
- :cli => [ '--post-remove', '-T', GetoptLong::REQUIRED_ARGUMENT ],
342
- :label => "Post-uninstall script",
343
- :display_conversion => DISPLAY_DFT_NONE,
344
- :get => :get_post_remove_script,
345
- :unsetable => true,
346
- :validate => :validate_post_remove_script
347
- },
348
- expiration: {
349
- :default => DFT_EXPIRATION,
350
- :cli => [ '--expiration', '-X', GetoptLong::REQUIRED_ARGUMENT ],
351
- :label => "Expiration",
352
- :display_conversion => nil,
353
- :get => :get_expiration,
354
- :unsetable => true,
355
- :validate => :validate_expiration
356
- },
357
- expiration_paths: {
358
- :default => nil,
359
- :cli => [ '--expiration-path', '--expiration-paths', '-P', GetoptLong::REQUIRED_ARGUMENT ],
360
- :label=> "Expiration Path(s)",
361
- :display_conversion => D3::Database::ARRAY_OF_PATHNAMES_TO_COMMA_STRING ,
362
- :get => :get_expiration_paths,
363
- :unsetable => true,
364
- :validate => :validate_expiration_paths,
365
- :compare => Proc.new{|o,n| o.to_a.sort == n.to_a.sort}
366
- },
367
- description: {
368
- :default => '',
369
- :cli => [ '--description', '-d', GetoptLong::REQUIRED_ARGUMENT ],
370
- :label => "Description",
371
- :display_conversion => Proc.new{|v| "\n----\n#{v.to_s.gsub("\r", "\n")}\n----"},
372
- :get => :get_description,
373
- :unsetable => true,
374
- :validate => nil
375
- },
398
+ frozen: {
399
+ default: nil,
400
+ cli: ['--frozen', '-z', GetoptLong::NO_ARGUMENT],
401
+ label: 'Report frozen receipts',
402
+ display_conversion: DISPLAY_LIST_TYPE,
403
+ get: :get_scoped_groups,
404
+ validate: :validate_scoped_groups
405
+ },
376
406
 
377
- # Search and Report
378
- status: {
379
- :default => nil,
380
- :cli => [ '--status', '-S', GetoptLong::REQUIRED_ARGUMENT ],
381
- :label => "Status for search and report",
382
- :display_conversion => DISPLAY_LIST_TYPE,
383
- :get => :get_scoped_groups,
384
- :validate => :validate_scoped_groups
385
- },
407
+ queue: {
408
+ default: nil,
409
+ cli: ['--queue', '-q', GetoptLong::NO_ARGUMENT],
410
+ label: 'Report pending puppies rather than receipts',
411
+ display_conversion: DISPLAY_LIST_TYPE,
412
+ get: :get_scoped_groups,
413
+ validate: :validate_scoped_groups
414
+ },
386
415
 
387
- frozen: {
388
- :default => nil,
389
- :cli => [ '--frozen', '-z', GetoptLong::NO_ARGUMENT ],
390
- :label => "Report frozen receipts",
391
- :display_conversion => DISPLAY_LIST_TYPE,
392
- :get => :get_scoped_groups,
393
- :validate => :validate_scoped_groups
394
- },
416
+ computers: {
417
+ default: nil,
418
+ cli: ['--computers', GetoptLong::NO_ARGUMENT],
419
+ label: 'Report targets are computers, not basenames',
420
+ display_conversion: DISPLAY_LIST_TYPE,
421
+ get: :get_scoped_groups,
422
+ validate: :validate_scoped_groups
423
+ },
395
424
 
396
- queue: {
397
- :default => nil,
398
- :cli => [ '--queue', '-q', GetoptLong::NO_ARGUMENT ],
399
- :label => "Report pending puppies rather than receipts",
400
- :display_conversion => DISPLAY_LIST_TYPE,
401
- :get => :get_scoped_groups,
402
- :validate => :validate_scoped_groups
403
- },
425
+ groups: {
426
+ default: nil,
427
+ cli: ['--groups', GetoptLong::NO_ARGUMENT],
428
+ label: 'Search targets are scoped groups, not basenames',
429
+ display_conversion: DISPLAY_LIST_TYPE,
430
+ get: :get_scoped_groups,
431
+ validate: :validate_scoped_groups
432
+ },
404
433
 
405
- computers: {
406
- :default => nil,
407
- :cli => [ '--computers', GetoptLong::NO_ARGUMENT ],
408
- :label => "Report targets are computers, not basenames",
409
- :display_conversion => DISPLAY_LIST_TYPE,
410
- :get => :get_scoped_groups,
411
- :validate => :validate_scoped_groups
412
- },
434
+ # Delete
435
+ keep_scripts: {
436
+ default: nil,
437
+ cli: ['--keep-scripts', GetoptLong::NO_ARGUMENT],
438
+ label: 'Keep associated scripts in Casper',
439
+ display_conversion: DISPLAY_TRUE_FALSE,
440
+ get: :get_keep_scripts,
441
+ validate: :validate_yes_no
442
+ },
443
+ keep_in_jss: {
444
+ default: nil,
445
+ cli: ['--keep-in-jss', GetoptLong::NO_ARGUMENT],
446
+ label: 'Keep the Casper package',
447
+ display_conversion: DISPLAY_TRUE_FALSE,
448
+ get: :get_keep_in_jss,
449
+ validate: :validate_yes_no
450
+ },
413
451
 
414
- groups: {
415
- :default => nil,
416
- :cli => [ '--groups', GetoptLong::NO_ARGUMENT ],
417
- :label => "Search targets are scoped groups, not basenames",
418
- :display_conversion => DISPLAY_LIST_TYPE,
419
- :get => :get_scoped_groups,
420
- :validate => :validate_scoped_groups
421
- },
452
+ # debug
453
+ debug: {
454
+ default: false,
455
+ cli: ['--debug', '-D', GetoptLong::NO_ARGUMENT],
456
+ label: 'Be more verbose',
457
+ display_conversion: DISPLAY_TRUE_FALSE,
458
+ get: nil,
459
+ validate: :validate_yes_no
460
+ },
422
461
 
423
-
424
- # Delete
425
- keep_scripts: {
426
- :default => nil,
427
- :cli => [ '--keep-scripts', GetoptLong::NO_ARGUMENT ],
428
- :label => "Keep associated scripts in Casper",
429
- :display_conversion => DISPLAY_TRUE_FALSE,
430
- :get => :get_keep_scripts,
431
- :validate => :validate_yes_no
432
- },
433
- keep_in_jss: {
434
- :default => nil,
435
- :cli => [ '--keep-in-jss', GetoptLong::NO_ARGUMENT ],
436
- :label => "Keep the Casper package",
437
- :display_conversion => DISPLAY_TRUE_FALSE,
438
- :get => :get_keep_in_jss,
439
- :validate => :validate_yes_no
440
- },
441
-
442
- # debug
443
- debug: {
444
- :default => false,
445
- :cli => [ '--debug', '-D', GetoptLong::NO_ARGUMENT ],
446
- :label => "Be more verbose",
447
- :display_conversion => DISPLAY_TRUE_FALSE,
448
- :get => nil,
449
- :validate => :validate_yes_no
450
- },
451
- d3_version: {
452
- :default => false,
453
- :cli => [ '--d3-version', GetoptLong::NO_ARGUMENT ],
454
- :label => "Display the version of d3admin and its libraries",
455
- :display_conversion => DISPLAY_TRUE_FALSE,
456
- :get => nil,
457
- :validate => nil
458
- }
462
+ d3_version: {
463
+ default: false,
464
+ cli: ['--d3-version', GetoptLong::NO_ARGUMENT],
465
+ label: 'Display the version of d3admin and its libraries',
466
+ display_conversion: DISPLAY_TRUE_FALSE,
467
+ get: nil,
468
+ validate: nil
459
469
  }
470
+ }.freeze
471
+
472
+ end # module Admin
460
473
 
461
- end # module admin
462
474
  end # module D3