xolo-server 1.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/client/xolo +152 -79
- data/lib/xolo/core/base_classes/title.rb +254 -18
- data/lib/xolo/core/base_classes/version.rb +47 -7
- data/lib/xolo/core/constants.rb +7 -3
- data/lib/xolo/core/security_cmd.rb +128 -0
- data/lib/xolo/core/version.rb +1 -1
- data/lib/xolo/core.rb +1 -0
- data/lib/xolo/server/app.rb +7 -0
- data/lib/xolo/server/configuration.rb +243 -37
- data/lib/xolo/server/constants.rb +10 -0
- data/lib/xolo/server/helpers/auth.rb +19 -2
- data/lib/xolo/server/helpers/autopkg.rb +157 -0
- data/lib/xolo/server/helpers/client_data.rb +90 -60
- data/lib/xolo/server/helpers/file_transfers.rb +412 -82
- data/lib/xolo/server/helpers/jamf_pro.rb +30 -7
- data/lib/xolo/server/helpers/log.rb +2 -0
- data/lib/xolo/server/helpers/maintenance.rb +1 -0
- data/lib/xolo/server/helpers/notification.rb +4 -3
- data/lib/xolo/server/helpers/pkg_signing.rb +16 -12
- data/lib/xolo/server/helpers/progress_streaming.rb +9 -12
- data/lib/xolo/server/helpers/subscriptions.rb +119 -0
- data/lib/xolo/server/helpers/titles.rb +27 -3
- data/lib/xolo/server/helpers/versions.rb +23 -11
- data/lib/xolo/server/mixins/changelog.rb +9 -16
- data/lib/xolo/server/mixins/title_jamf_access.rb +375 -385
- data/lib/xolo/server/mixins/title_ted_access.rb +29 -3
- data/lib/xolo/server/mixins/version_jamf_access.rb +95 -112
- data/lib/xolo/server/mixins/version_ted_access.rb +25 -0
- data/lib/xolo/server/object_locks.rb +2 -1
- data/lib/xolo/server/routes/auth.rb +2 -2
- data/lib/xolo/server/routes/jamf_pro.rb +11 -1
- data/lib/xolo/server/routes/maint.rb +2 -1
- data/lib/xolo/server/routes/subscriptions.rb +126 -0
- data/lib/xolo/server/routes/title_editor.rb +1 -1
- data/lib/xolo/server/routes/titles.rb +26 -11
- data/lib/xolo/server/routes/uploads.rb +0 -14
- data/lib/xolo/server/routes/versions.rb +14 -13
- data/lib/xolo/server/routes.rb +9 -0
- data/lib/xolo/server/title.rb +100 -77
- data/lib/xolo/server/version.rb +177 -15
- data/lib/xolo/server.rb +8 -0
- metadata +7 -9
|
@@ -74,6 +74,10 @@ module Xolo
|
|
|
74
74
|
# - immutable: [Boolean] This value can only be set when creatimg a new title.
|
|
75
75
|
# When editing an existing title, it cannot be changed.
|
|
76
76
|
#
|
|
77
|
+
# - title_type: [Symbol, nil] If set to :managed or :subscribed, this option
|
|
78
|
+
# is required, and only available, when the title is of that type. If nil or not set,
|
|
79
|
+
# the option is available for all title types.
|
|
80
|
+
#
|
|
77
81
|
# - cli: [Symbol, false] What is the 'short' option flag for this option?
|
|
78
82
|
# The long option flag is the key, preceded with '--' and with underscores
|
|
79
83
|
# changed to '-', so display_name is set using the cli option '--display-name'.
|
|
@@ -146,6 +150,12 @@ module Xolo
|
|
|
146
150
|
# - read_only: [Boolean] defaults to false. When true, the server maintains this value, and
|
|
147
151
|
# its only readable via xadm.
|
|
148
152
|
#
|
|
153
|
+
# - add_only: [Boolean] This option is only used when creating a new title, it is not
|
|
154
|
+
# available when editing an existing title.
|
|
155
|
+
#
|
|
156
|
+
# - edit_only: [Boolean] This option is only used when editing an existing title, it is not
|
|
157
|
+
# available when creating a new title.
|
|
158
|
+
#
|
|
149
159
|
# - hide_from_info: [Boolean] when true, do not show this attribute in the 'info' xadm output
|
|
150
160
|
# NOTE: it will still be available when --json is given with the info command.
|
|
151
161
|
#
|
|
@@ -172,20 +182,40 @@ module Xolo
|
|
|
172
182
|
ENDDESC
|
|
173
183
|
},
|
|
174
184
|
|
|
175
|
-
# @!attribute
|
|
176
|
-
# @return [
|
|
177
|
-
|
|
178
|
-
label: '
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
validate: :
|
|
184
|
-
|
|
185
|
+
# @!attribute subscribed
|
|
186
|
+
# @return [Boolean] is this title subscribed via a Jamf Patch Source?
|
|
187
|
+
subscribed: {
|
|
188
|
+
label: 'Subscribed?',
|
|
189
|
+
cli: :B,
|
|
190
|
+
type: :boolean,
|
|
191
|
+
immutable: true,
|
|
192
|
+
add_only: true,
|
|
193
|
+
validate: :validate_boolean,
|
|
194
|
+
default: false,
|
|
185
195
|
changelog: true,
|
|
186
196
|
desc: <<~ENDDESC
|
|
187
|
-
|
|
188
|
-
|
|
197
|
+
Is this title subscribed via a Jamf Patch Source? If not, it is managed by Xolo. By default titles are managed. Once created, titles cannot be changed between managed and subscribed.
|
|
198
|
+
|
|
199
|
+
Managed titles have their entire definition, versions and updates managed by Xolo; xadm is used to provide basic details about the title, such as a the display name, publisher, the mechanism by which Jamf Pro knows which version is installed on a Mac. Versions of managed titles are also added and maintained via xadm, setting values such as killapps, OS restrictions, and so on.
|
|
200
|
+
|
|
201
|
+
Subscribed titles and their version definitions are maintained by a Patch Source configrued in Jamf Pro. The source defines some aspects of the title and its versions, including the display name, publisher, and mechanism for determining installed versions. New versions are also managed by the Patch Source, including killapps, OS restrictions, and other settings. When they appear, Xolo will at least inform someone (notify the contact email) that a new version is available and needs a .pkg, but can also use autopkg to automatically fetch .pkgs and add new versions for piloting.
|
|
202
|
+
|
|
203
|
+
When a title is subscribed, these options are required:
|
|
204
|
+
--patch-source
|
|
205
|
+
--title-id
|
|
206
|
+
|
|
207
|
+
and these are not available, since the patch source manages them:
|
|
208
|
+
--display-name
|
|
209
|
+
--publisher
|
|
210
|
+
--app-name
|
|
211
|
+
--app-bundle-id
|
|
212
|
+
--version-script
|
|
213
|
+
|
|
214
|
+
When a subscribed title is added, a Xolo Version is automatically added for the most recent version available from the Patch Source.
|
|
215
|
+
|
|
216
|
+
Once created as subscribed or managed, a title cannot be changed to the other type. If you need to change the type, you must delete and re-create the title. Also once created, the patch source and title id for a subscribed title cannot be changed.
|
|
217
|
+
|
|
218
|
+
In all cases, a .pkg must be provided for each version known to Xolo, either by uploading it via xadm or configuring the server and the title to use AutoPkg to acquire it.
|
|
189
219
|
ENDDESC
|
|
190
220
|
},
|
|
191
221
|
|
|
@@ -202,12 +232,12 @@ module Xolo
|
|
|
202
232
|
invalid_msg: <<~ENDINV,
|
|
203
233
|
Not a valid description, must be at least #{MIN_TITLE_DESC_LENGTH} characters.
|
|
204
234
|
|
|
205
|
-
Provide a useful dscription of what the software does, URLs, developer names, etc.
|
|
235
|
+
Provide a useful dscription of what the software does, why it's in Xolo, URLs, developer names, etc.
|
|
206
236
|
|
|
207
237
|
DO NOT USE, e.g. 'Installs Some App', because we know that already and it isn't helpful.
|
|
208
238
|
ENDINV
|
|
209
239
|
desc: <<~ENDDESC
|
|
210
|
-
A useful dscription of what the software installed by this title does. You can also include URLs, developer names, support info, etc.
|
|
240
|
+
A useful dscription of what the software installed by this title does or why it's in Xolo. You can also include URLs, developer names, support info, etc.
|
|
211
241
|
|
|
212
242
|
DO NOT use, e.g. 'Installs Some App', because we know that already and it isn't helpful.
|
|
213
243
|
|
|
@@ -217,19 +247,44 @@ module Xolo
|
|
|
217
247
|
ENDDESC
|
|
218
248
|
},
|
|
219
249
|
|
|
250
|
+
# @!attribute display_name
|
|
251
|
+
# @return [String] The display-name for this title
|
|
252
|
+
display_name: {
|
|
253
|
+
label: 'Display Name',
|
|
254
|
+
ted_attribute: :name,
|
|
255
|
+
title_type: Xolo::MANAGED,
|
|
256
|
+
# required: true, # only required if not subscribed
|
|
257
|
+
cli: :n,
|
|
258
|
+
type: :string,
|
|
259
|
+
validate: :validate_title_display_name,
|
|
260
|
+
walkthru_na: :display_name_na,
|
|
261
|
+
invalid_msg: 'Not a valid display name, must be at least three characters long.',
|
|
262
|
+
changelog: true,
|
|
263
|
+
desc: <<~ENDDESC
|
|
264
|
+
A human-friendly name for the Software Title, e.g. 'Google Chrome', or 'NFS Menubar'.
|
|
265
|
+
Must be at least three characters long.
|
|
266
|
+
|
|
267
|
+
Cannot be used for subscribed titles, since the Patch Source defines the display name for those.
|
|
268
|
+
ENDDESC
|
|
269
|
+
},
|
|
270
|
+
|
|
220
271
|
# @!attribute publisher
|
|
221
272
|
# @return [String] The entity that publishes this title
|
|
222
273
|
publisher: {
|
|
223
274
|
label: 'Publisher',
|
|
224
275
|
ted_attribute: :publisher,
|
|
225
|
-
required: true,
|
|
276
|
+
# required: true, # only required if not subscribed
|
|
277
|
+
title_type: Xolo::MANAGED,
|
|
226
278
|
cli: :P,
|
|
227
279
|
type: :string,
|
|
280
|
+
walkthru_na: :publisher_na,
|
|
228
281
|
validate: true,
|
|
229
282
|
changelog: true,
|
|
230
283
|
invalid_msg: '"Not a valid Publisher, must be at least three characters.',
|
|
231
284
|
desc: <<~ENDDESC
|
|
232
285
|
The company or entity that publishes this title, e.g. 'Apple, Inc.' or 'Pixar Animation Studios'.
|
|
286
|
+
|
|
287
|
+
Cannot be used for subscribed titles, since the Patch Source defines the publisher for those.
|
|
233
288
|
ENDDESC
|
|
234
289
|
},
|
|
235
290
|
|
|
@@ -238,6 +293,7 @@ module Xolo
|
|
|
238
293
|
app_name: {
|
|
239
294
|
label: 'App Name',
|
|
240
295
|
ted_attribute: :appName,
|
|
296
|
+
title_type: Xolo::MANAGED,
|
|
241
297
|
cli: :a,
|
|
242
298
|
validate: true,
|
|
243
299
|
type: :string,
|
|
@@ -251,6 +307,8 @@ module Xolo
|
|
|
251
307
|
|
|
252
308
|
If the title does not install a .app bundle, leave this blank, and provide a --version-script.
|
|
253
309
|
|
|
310
|
+
Cannot be used for subscribed titles, since the Patch Source defines the app name for those.
|
|
311
|
+
|
|
254
312
|
REQUIRED if --app-bundle-id is used.
|
|
255
313
|
ENDDESC
|
|
256
314
|
},
|
|
@@ -260,6 +318,7 @@ module Xolo
|
|
|
260
318
|
app_bundle_id: {
|
|
261
319
|
label: 'App Bundle ID',
|
|
262
320
|
ted_attribute: :bundleId,
|
|
321
|
+
title_type: Xolo::MANAGED,
|
|
263
322
|
cli: :b,
|
|
264
323
|
validate: true,
|
|
265
324
|
type: :string,
|
|
@@ -273,6 +332,8 @@ module Xolo
|
|
|
273
332
|
|
|
274
333
|
If the title does not install a .app bundle, or if the .app doesn't provide its version via the bundle id (e.g. Firefox) leave this blank, and provide a --version-script.
|
|
275
334
|
|
|
335
|
+
Cannot be used for subscribed titles, since the Patch Source defines the bundle ID for those.
|
|
336
|
+
|
|
276
337
|
REQUIRED if --app-name is used.
|
|
277
338
|
ENDDESC
|
|
278
339
|
},
|
|
@@ -282,6 +343,7 @@ module Xolo
|
|
|
282
343
|
# title on a client mac
|
|
283
344
|
version_script: {
|
|
284
345
|
label: 'Version Script',
|
|
346
|
+
title_type: Xolo::MANAGED,
|
|
285
347
|
cli: :v,
|
|
286
348
|
# while the script is stored in the Title Editor as the extension attribute
|
|
287
349
|
# its handled differently, so we don't specify a ted_attribute here.
|
|
@@ -299,7 +361,130 @@ module Xolo
|
|
|
299
361
|
and if no version of the title is installed, it should output:
|
|
300
362
|
<result></result>
|
|
301
363
|
|
|
302
|
-
|
|
364
|
+
Cannot be used for subscribed titles, since the Patch Source defines the version script for those.
|
|
365
|
+
|
|
366
|
+
REQUIRED unless --app-name and --app-bundle-id are used.
|
|
367
|
+
ENDDESC
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
# @!attribute patch_source
|
|
371
|
+
# @return [String] The name of the Jamf Patch Source that provides this title via subscription
|
|
372
|
+
patch_source: {
|
|
373
|
+
label: 'Subscription Patch Source',
|
|
374
|
+
title_type: Xolo::SUBSCRIBED,
|
|
375
|
+
cli: :S,
|
|
376
|
+
type: :string,
|
|
377
|
+
immutable: true,
|
|
378
|
+
validate: true,
|
|
379
|
+
add_only: true,
|
|
380
|
+
walkthru_na: :patch_source_na,
|
|
381
|
+
readline: :jamf_patch_sources_with_available_titles,
|
|
382
|
+
invalid_msg: 'Invalid Patch Source. Unknown Patch Source Name, or it has no available titles.',
|
|
383
|
+
desc: <<~ENDDESC
|
|
384
|
+
The name of the Jamf Patch Source that provides this title via subscription.
|
|
385
|
+
|
|
386
|
+
This value and --title-id are required for 'subscribed' titles.
|
|
387
|
+
|
|
388
|
+
To see a list of titles available for subscription, with their Patch Sources and IDs, use `xadm list-available`.
|
|
389
|
+
|
|
390
|
+
Can only be used when adding a new title, not when editing an existing one.
|
|
391
|
+
ENDDESC
|
|
392
|
+
|
|
393
|
+
},
|
|
394
|
+
|
|
395
|
+
# @!attribute title_id
|
|
396
|
+
# @return [String] The TitleID of the title on the specified Patch Source
|
|
397
|
+
title_id: {
|
|
398
|
+
label: 'Subscription Title ID',
|
|
399
|
+
title_type: Xolo::SUBSCRIBED,
|
|
400
|
+
cli: :T,
|
|
401
|
+
type: :string,
|
|
402
|
+
immutable: true,
|
|
403
|
+
add_only: true,
|
|
404
|
+
walkthru_na: :title_id_na,
|
|
405
|
+
validate: true,
|
|
406
|
+
invalid_msg: 'Invalid Title ID. Not available in any Patch Source.',
|
|
407
|
+
desc: <<~ENDDESC
|
|
408
|
+
The TitleID of the title on the specified Patch Source.
|
|
409
|
+
|
|
410
|
+
This is the unique identifier for each title on a patch source, it is a sometimes-meaningless string of alphanumeric characters.
|
|
411
|
+
|
|
412
|
+
To find the TitleID of a title available for subscription, use `xadm list-available`
|
|
413
|
+
|
|
414
|
+
Can only be used when adding a new title, not when editing an existing one.
|
|
415
|
+
ENDDESC
|
|
416
|
+
|
|
417
|
+
},
|
|
418
|
+
|
|
419
|
+
# TODO: Add validation?
|
|
420
|
+
# @!attribute autopkg_recipe
|
|
421
|
+
# @return [String] The autopkg recipe to run when new versions are added to this title
|
|
422
|
+
autopkg_recipe: {
|
|
423
|
+
label: 'AutoPkg Recipe',
|
|
424
|
+
cli: :R,
|
|
425
|
+
validate: false,
|
|
426
|
+
type: :string,
|
|
427
|
+
changelog: true,
|
|
428
|
+
invalid_msg: "Unknown autopkg recipe. Use one that is configured on the server, or '#{Xolo::NONE}'.",
|
|
429
|
+
desc: <<~ENDDESC
|
|
430
|
+
The name of an autopkg recipe to run when a new version is added to this title. It is expected that the version being added is the latest available and will match the .pkg acquired by a run of the recipe.
|
|
431
|
+
|
|
432
|
+
AutoPkg, and the recipe, must be installed and configured on the xoloserver host.
|
|
433
|
+
|
|
434
|
+
When using this, --autopkg-dir must also be provided
|
|
435
|
+
|
|
436
|
+
To unset, use '#{Xolo::NONE}'
|
|
437
|
+
ENDDESC
|
|
438
|
+
},
|
|
439
|
+
|
|
440
|
+
# TODO: Add validation?
|
|
441
|
+
# @!attribute autopkg_dir
|
|
442
|
+
# @return [String] The path containg the .pkg acquired by the --autopkg-recipe
|
|
443
|
+
autopkg_dir: {
|
|
444
|
+
label: 'AutoPkg Output Directory',
|
|
445
|
+
cli: :D,
|
|
446
|
+
validate: false,
|
|
447
|
+
type: :string,
|
|
448
|
+
changelog: true,
|
|
449
|
+
invalid_msg: "Must be an absolute path starting with / and containing at least one more /, or '#{Xolo::NONE}'.",
|
|
450
|
+
desc: <<~ENDDESC
|
|
451
|
+
The path to the directory where the --autopkg-recipe will store the acquired .pkg.
|
|
452
|
+
|
|
453
|
+
After running the recipe, xoloserver will look for the newest .pkg file in this directory and upload it to the Jamf distribution servers, as with any other pkg.
|
|
454
|
+
|
|
455
|
+
Required when using --autopkg-recipe
|
|
456
|
+
|
|
457
|
+
To unset, use '#{Xolo::NONE}'
|
|
458
|
+
ENDDESC
|
|
459
|
+
},
|
|
460
|
+
|
|
461
|
+
# @!attribute pilot_groups
|
|
462
|
+
# @return [Array<String>] Jamf groups that will automatically get new versions installed or
|
|
463
|
+
# updated when added, for piloting
|
|
464
|
+
pilot_groups: {
|
|
465
|
+
label: 'Pilot Computer Groups',
|
|
466
|
+
cli: :p,
|
|
467
|
+
validate: true,
|
|
468
|
+
type: :string,
|
|
469
|
+
multi: true,
|
|
470
|
+
changelog: true,
|
|
471
|
+
readline_prompt: 'Group Name',
|
|
472
|
+
readline: :jamf_computer_group_names,
|
|
473
|
+
invalid_msg: "Invalid group. Must be an existing Jamf Computer Group, or '#{Xolo::NONE}'.",
|
|
474
|
+
desc: <<~ENDDESC
|
|
475
|
+
One or more Jamf Computer Groups whose members will automatically have new versions installed or updated for testing before it is released.
|
|
476
|
+
|
|
477
|
+
These computers will be used for testing not just the software, but the installation process itself. Exclusions win, so computers that are also in an excluded group for the title will not be used as pilots.
|
|
478
|
+
|
|
479
|
+
Pilot groups can also be defined per version, in which case these will be ignored. Defining them in the title is useful for subscribed titles, where new versions are created automatically.
|
|
480
|
+
|
|
481
|
+
When a version is released, the computers in the release_groups defined in the title will automatically have this version installed - and any non-frozen computers with an older version will have it updated.
|
|
482
|
+
|
|
483
|
+
When using the --pilot-groups CLI option, you can specify more than one group by using the option more than once, or by providing a single option value with the groups separated by commas.
|
|
484
|
+
|
|
485
|
+
When adding a new version, the pilot groups from the previous version will be inherited if you don't specify any. To make the new version have no pilot groups, and fall back to these defined in the title, use '#{Xolo::NONE}'
|
|
486
|
+
|
|
487
|
+
NOTE: Any non-excluded computer can be used for piloting at any time by manually installing the yet-to-be-released version using `sudo xolo install` or `xadm deploy`. The members of the pilot groups are just the ones that will have it auto-installed.
|
|
303
488
|
ENDDESC
|
|
304
489
|
},
|
|
305
490
|
|
|
@@ -609,12 +794,50 @@ module Xolo
|
|
|
609
794
|
desc: <<~ENDDESC
|
|
610
795
|
The currently released version
|
|
611
796
|
ENDDESC
|
|
797
|
+
},
|
|
798
|
+
|
|
799
|
+
# @!attribute ted_id_number
|
|
800
|
+
# @return [Integer] The Windoo::SoftwareTitle#softwareTitleId
|
|
801
|
+
ted_id_number: {
|
|
802
|
+
label: 'Title Editor ID Number',
|
|
803
|
+
type: :integer,
|
|
804
|
+
cli: false,
|
|
805
|
+
changelog: false,
|
|
806
|
+
read_only: true, # maintained by the server, not editable by xadm
|
|
807
|
+
desc: <<~ENDDESC
|
|
808
|
+
The id number of the matching Software Title in the Title Editor
|
|
809
|
+
ENDDESC
|
|
810
|
+
},
|
|
811
|
+
|
|
812
|
+
# @!attribute jamf_patch_title_id
|
|
813
|
+
# @return [Integer] The Windoo::SoftwareTitle#softwareTitleId
|
|
814
|
+
jamf_patch_title_id: {
|
|
815
|
+
label: 'The Jamf ID Number of this Patch Title',
|
|
816
|
+
type: :integer,
|
|
817
|
+
cli: false,
|
|
818
|
+
changelog: false,
|
|
819
|
+
read_only: true, # maintained by the server, not editable by xadm
|
|
820
|
+
desc: <<~ENDDESC
|
|
821
|
+
The id number of the matching Patch Title in the Jamf Pro
|
|
822
|
+
ENDDESC
|
|
612
823
|
}
|
|
613
824
|
|
|
614
825
|
}.freeze
|
|
615
826
|
|
|
616
|
-
ATTRIBUTES.
|
|
827
|
+
ATTRIBUTES.each do |attr, deets|
|
|
617
828
|
attr_accessor attr
|
|
829
|
+
|
|
830
|
+
# boolean attrs get a ? method
|
|
831
|
+
alias_method "#{attr}?", attr if deets[:type] == :boolean
|
|
832
|
+
|
|
833
|
+
next unless deets[:multi]
|
|
834
|
+
|
|
835
|
+
# ensure that multi value attrs return an empty array if nil
|
|
836
|
+
define_method attr do
|
|
837
|
+
iv = "@#{attr}"
|
|
838
|
+
instance_variable_set(iv, []) if instance_variable_get(iv).nil?
|
|
839
|
+
instance_variable_get(iv)
|
|
840
|
+
end
|
|
618
841
|
end
|
|
619
842
|
|
|
620
843
|
# Constructor
|
|
@@ -632,13 +855,26 @@ module Xolo
|
|
|
632
855
|
######################
|
|
633
856
|
|
|
634
857
|
# the latest version of this title in Xolo
|
|
635
|
-
# @param cnx [Faraday::Connection] The connection to use, must be logged in already
|
|
636
858
|
# @return [String]
|
|
637
859
|
####################
|
|
638
860
|
def latest_version
|
|
639
861
|
version_order&.first
|
|
640
862
|
end
|
|
641
863
|
|
|
864
|
+
# Is this a managed title?
|
|
865
|
+
# @return [Boolean]
|
|
866
|
+
#######################
|
|
867
|
+
def managed?
|
|
868
|
+
!subscribed?
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
# Does this title get its pkgs from AutoPkg?
|
|
872
|
+
# @return [Boolean]
|
|
873
|
+
############################
|
|
874
|
+
def autopkg_enabled?
|
|
875
|
+
autopkg_recipe && autopkg_dir
|
|
876
|
+
end
|
|
877
|
+
|
|
642
878
|
end # class Title
|
|
643
879
|
|
|
644
880
|
end # module BaseClasses
|
|
@@ -110,6 +110,7 @@ module Xolo
|
|
|
110
110
|
label: 'Publish Date',
|
|
111
111
|
type: :time,
|
|
112
112
|
default: -> { Time.now.to_s },
|
|
113
|
+
title_type: Xolo::MANAGED,
|
|
113
114
|
do_not_inherit: true,
|
|
114
115
|
cli: :d,
|
|
115
116
|
validate: true,
|
|
@@ -128,6 +129,7 @@ module Xolo
|
|
|
128
129
|
label: 'Minimum OS',
|
|
129
130
|
cli: :o,
|
|
130
131
|
type: :string,
|
|
132
|
+
title_type: Xolo::MANAGED,
|
|
131
133
|
required: false,
|
|
132
134
|
validate: true,
|
|
133
135
|
default: DEFAULT_MIN_OS,
|
|
@@ -145,6 +147,7 @@ module Xolo
|
|
|
145
147
|
label: 'Maximum OS',
|
|
146
148
|
cli: :O,
|
|
147
149
|
type: :string,
|
|
150
|
+
title_type: Xolo::MANAGED,
|
|
148
151
|
validate: true,
|
|
149
152
|
changelog: true,
|
|
150
153
|
# default: Xolo::NONE,
|
|
@@ -160,6 +163,7 @@ module Xolo
|
|
|
160
163
|
label: 'Reboot',
|
|
161
164
|
cli: :r,
|
|
162
165
|
type: :boolean,
|
|
166
|
+
title_type: Xolo::MANAGED,
|
|
163
167
|
validate: :validate_boolean,
|
|
164
168
|
ted_attribute: :reboot,
|
|
165
169
|
default: false,
|
|
@@ -175,6 +179,7 @@ module Xolo
|
|
|
175
179
|
label: 'Standalone',
|
|
176
180
|
cli: :s,
|
|
177
181
|
type: :boolean,
|
|
182
|
+
title_type: Xolo::MANAGED,
|
|
178
183
|
validate: :validate_boolean,
|
|
179
184
|
default: true,
|
|
180
185
|
ted_attribute: :standalone,
|
|
@@ -190,7 +195,10 @@ module Xolo
|
|
|
190
195
|
label: 'KillApps',
|
|
191
196
|
cli: :k,
|
|
192
197
|
type: :string,
|
|
198
|
+
title_type: Xolo::MANAGED,
|
|
193
199
|
multi: true,
|
|
200
|
+
readline: true,
|
|
201
|
+
readline_prompt: 'KillApp',
|
|
194
202
|
validate: true,
|
|
195
203
|
changelog: true,
|
|
196
204
|
# default: Xolo::NONE,
|
|
@@ -212,12 +220,31 @@ module Xolo
|
|
|
212
220
|
ENDDESC
|
|
213
221
|
},
|
|
214
222
|
|
|
223
|
+
# @!attribute patch_unknown
|
|
224
|
+
# @return [Boolean] Should 'unknown' versions of this title be updated to this version automatically?
|
|
225
|
+
patch_unknown: {
|
|
226
|
+
label: 'Patch Unknown Versions',
|
|
227
|
+
cli: :U,
|
|
228
|
+
type: :boolean,
|
|
229
|
+
validate: :validate_boolean,
|
|
230
|
+
default: false,
|
|
231
|
+
changelog: true,
|
|
232
|
+
desc: <<~ENDDESC
|
|
233
|
+
Should 'unknown' versions of this title be updated to this version automatically by Jamf Patch Management?
|
|
234
|
+
|
|
235
|
+
When Jamf Patch determines that a title is installed on a computer, but version reported is not among those known to Jamf Patch, it marks the version as 'unknown'. Setting this option to true will cause Jamf Patch to automatically install the pkg for this version on those Macs with 'unknown' versions.
|
|
236
|
+
|
|
237
|
+
This can cause problems if that unknown version is actually newer than this version, e.g. a beta or pre-release version, or when the app has a 'self-update' mechanism that installs newer versions outside of Jamf Patch before it is aware of them.
|
|
238
|
+
|
|
239
|
+
But sometimes it may be desirable to have all unknown versions updated to this version, e.g. when the title is a helper app that is not regularly updated, or when the title is being newly managed by Xolo/Jamf Patch and you want to get all existing installations onto this version.
|
|
240
|
+
ENDDESC
|
|
241
|
+
},
|
|
242
|
+
|
|
215
243
|
# @!attribute pilot_groups
|
|
216
244
|
# @return [Array<String>] Jamf groups that will automatically get this version installed or
|
|
217
245
|
# updated for piloting
|
|
218
246
|
pilot_groups: {
|
|
219
247
|
label: 'Pilot Computer Groups',
|
|
220
|
-
# default: Xolo::NONE,
|
|
221
248
|
cli: :p,
|
|
222
249
|
validate: true,
|
|
223
250
|
type: :string,
|
|
@@ -247,13 +274,12 @@ module Xolo
|
|
|
247
274
|
pkg_to_upload: {
|
|
248
275
|
label: 'Upload Package',
|
|
249
276
|
type: :string,
|
|
250
|
-
required: true,
|
|
251
277
|
cli: :u,
|
|
252
278
|
validate: true,
|
|
253
279
|
readline: :get_files,
|
|
254
280
|
do_not_inherit: true,
|
|
255
281
|
hide_from_info: true,
|
|
256
|
-
invalid_msg: 'Invalid installer pkg. Must exist locally and be a .pkg file
|
|
282
|
+
invalid_msg: 'Invalid installer pkg. Must exist locally and be a flat .pkg file',
|
|
257
283
|
desc: <<~ENDDESC
|
|
258
284
|
The path to a local copy of the installer package for this version. Will be uploaded to Xolo and then Jamf Pro distribution point(s), replacing any previously uploaded.
|
|
259
285
|
|
|
@@ -261,6 +287,8 @@ module Xolo
|
|
|
261
287
|
|
|
262
288
|
It will be renamed to 'xolo-<title>-<version>.pkg' (or .zip).
|
|
263
289
|
If your Xolo server is confiured to sign unsigned packages, it will do so along the way.
|
|
290
|
+
|
|
291
|
+
Required when creating a new version unless the title is configrued to use autopkg.
|
|
264
292
|
ENDDESC
|
|
265
293
|
},
|
|
266
294
|
|
|
@@ -448,6 +476,7 @@ module Xolo
|
|
|
448
476
|
# @!attribute jamf_pkg_id
|
|
449
477
|
# @return [String] The id of the Jamf Package object that installs this version.
|
|
450
478
|
# This is an integer in a string, as are all IDs in the Jamf Pro API.
|
|
479
|
+
# TODO: Stop using pkgID - or any jamf ID, use names for accessing all jamf objects
|
|
451
480
|
jamf_pkg_id: {
|
|
452
481
|
label: 'Jamf Package ID',
|
|
453
482
|
type: :string,
|
|
@@ -461,7 +490,7 @@ module Xolo
|
|
|
461
490
|
|
|
462
491
|
# @!attribute jamf_pkg_file
|
|
463
492
|
# @return [String] The file name of the installer.pkg file used by the Jamf Package object to
|
|
464
|
-
# installs this version. 'xolo-<title>-<version>.pkg'
|
|
493
|
+
# installs this version. 'xolo-<title>-<version>.pkg'
|
|
465
494
|
jamf_pkg_file: {
|
|
466
495
|
label: 'Jamf Package File',
|
|
467
496
|
type: :string,
|
|
@@ -541,7 +570,7 @@ module Xolo
|
|
|
541
570
|
# @!attribute sha_512
|
|
542
571
|
# @return [String] The SHA512 checksum of the most recently uploaded package
|
|
543
572
|
sha_512: {
|
|
544
|
-
label: 'Package Checksum',
|
|
573
|
+
label: 'Package Checksum (SHA512)',
|
|
545
574
|
type: :string,
|
|
546
575
|
do_not_inherit: true,
|
|
547
576
|
cli: false,
|
|
@@ -554,9 +583,20 @@ module Xolo
|
|
|
554
583
|
|
|
555
584
|
}.freeze
|
|
556
585
|
|
|
557
|
-
ATTRIBUTES.
|
|
586
|
+
ATTRIBUTES.each do |attr, deets|
|
|
558
587
|
attr_accessor attr
|
|
559
|
-
|
|
588
|
+
|
|
589
|
+
# boolean attrs get a ? method
|
|
590
|
+
alias_method "#{attr}?", attr if deets[:type] == :boolean
|
|
591
|
+
|
|
592
|
+
next unless deets[:multi]
|
|
593
|
+
|
|
594
|
+
# ensure that multi value attrs return an empty array if nil
|
|
595
|
+
define_method attr do
|
|
596
|
+
ivar_name = "@#{attr}"
|
|
597
|
+
instance_variable_set(ivar_name, []) if instance_variable_get(ivar_name).nil?
|
|
598
|
+
instance_variable_get(ivar_name)
|
|
599
|
+
end
|
|
560
600
|
end
|
|
561
601
|
|
|
562
602
|
# Constructor
|
data/lib/xolo/core/constants.rb
CHANGED
|
@@ -58,17 +58,21 @@ module Xolo
|
|
|
58
58
|
|
|
59
59
|
DOT_PKG = '.pkg'
|
|
60
60
|
|
|
61
|
-
DOT_ZIP = '.zip'
|
|
62
|
-
|
|
63
61
|
UNKNOWN = 'unknown'
|
|
64
62
|
|
|
65
63
|
# Installer packages must have one of these extensions
|
|
66
|
-
OK_PKG_EXTS = [DOT_PKG
|
|
64
|
+
OK_PKG_EXTS = [DOT_PKG]
|
|
67
65
|
|
|
68
66
|
# The value to use when all computers are the release-targets
|
|
69
67
|
# and for all manual-install policies
|
|
70
68
|
TARGET_ALL = 'all'
|
|
71
69
|
|
|
70
|
+
# Title Types
|
|
71
|
+
MANAGED = :managed
|
|
72
|
+
SUBSCRIBED = :subscribed
|
|
73
|
+
TITLE_TYPES = [MANAGED, SUBSCRIBED].freeze
|
|
74
|
+
DEFAULT_TITLE_TYPE = :managed
|
|
75
|
+
|
|
72
76
|
# when this module is included
|
|
73
77
|
def self.included(includer)
|
|
74
78
|
Xolo.verbose_include includer, self
|