xolo-admin 2.4.0 → 2.6.0
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/lib/xolo/admin/options.rb +15 -1
- data/lib/xolo/admin/processing.rb +22 -4
- data/lib/xolo/admin/title.rb +8 -1
- data/lib/xolo/admin/validate.rb +47 -9
- data/lib/xolo/admin.rb +18 -10
- data/lib/xolo/core/base_classes/title.rb +25 -2
- data/lib/xolo/core/constants.rb +3 -0
- data/lib/xolo/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ccdc173618b98fb0c96607bba885ec3c63b3c22c7d52cad4cd1390cf55ce058
|
|
4
|
+
data.tar.gz: 58805fd1833ac1c8954f4145ea739d71918fc6b0b5872695f797a091ce068117
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 410426c7eee8820469936bcb2e38c6a568a0bbdb7decb87b3e7c79d612415b6ead5b05473cce72725eabbc27a92b2bb8c8875a05f748ae372275baff06746425
|
|
7
|
+
data.tar.gz: 25e8b88f8372daea0801361109833ce270b97b0975b6e169d5492739f782f091ecd6da5bc8032583843ad1145d8b67c41c0f039fc7e2f799f1e2310f28a31ed5
|
data/lib/xolo/admin/options.rb
CHANGED
|
@@ -158,7 +158,8 @@ module Xolo
|
|
|
158
158
|
FREEZE_TITLE_CMD = 'freeze'
|
|
159
159
|
THAW_TITLE_CMD = 'thaw'
|
|
160
160
|
LIST_FROZEN_CMD = 'list-frozen'
|
|
161
|
-
RERUN_AUTOPKG_RECIPE_CMD = 'rerun-autopkg
|
|
161
|
+
RERUN_AUTOPKG_RECIPE_CMD = 'rerun-autopkg'
|
|
162
|
+
RERUN_SUBSCRIPTION_CMD = 'rerun-sub'
|
|
162
163
|
|
|
163
164
|
LIST_VERSIONS_CMD = 'list-versions'
|
|
164
165
|
ADD_VERSION_CMD = 'add-version'
|
|
@@ -612,6 +613,19 @@ module Xolo
|
|
|
612
613
|
confirmation: true
|
|
613
614
|
},
|
|
614
615
|
|
|
616
|
+
RERUN_SUBSCRIPTION_CMD => {
|
|
617
|
+
desc: 'Re-add the latest version for this title as if a subscription update just happened.',
|
|
618
|
+
display: "#{RERUN_SUBSCRIPTION_CMD} title",
|
|
619
|
+
long_desc: <<~ENDLONG,
|
|
620
|
+
The most recent version of the title, if 'pilot' or 'pending', is deleted and the subscription update process is triggered again to re-create it. Useful when the process had some error the previous time it ran.
|
|
621
|
+
ENDLONG
|
|
622
|
+
opts: {},
|
|
623
|
+
target: :title,
|
|
624
|
+
process_method: :rerun_subscription_update,
|
|
625
|
+
streamed_response: true,
|
|
626
|
+
confirmation: true
|
|
627
|
+
},
|
|
628
|
+
|
|
615
629
|
ADD_VERSION_CMD => {
|
|
616
630
|
desc: 'Add a new version to a title, making it available for piloting',
|
|
617
631
|
display: "#{ADD_VERSION_CMD} title version",
|
|
@@ -519,14 +519,32 @@ module Xolo
|
|
|
519
519
|
return unless confirmed? "Re-run the AutoPkg recipe for '#{cli_cmd.title}' and re-upload the new pkg"
|
|
520
520
|
|
|
521
521
|
title = Xolo::Admin::Title.fetch cli_cmd.title, server_cnx
|
|
522
|
-
|
|
523
522
|
response_data = title.rerun_autopkg_recipe server_cnx
|
|
524
523
|
|
|
525
524
|
show_debug "response_data: #{response_data}"
|
|
526
525
|
|
|
527
526
|
display_progress response_data[:progress_stream_url_path]
|
|
528
527
|
|
|
529
|
-
speak "Recipe
|
|
528
|
+
speak "Recipe has run for '#{cli_cmd.title}'. Please wait up to 15 minutes for a new pkg to be available."
|
|
529
|
+
rescue StandardError => e
|
|
530
|
+
handle_processing_error e
|
|
531
|
+
end
|
|
532
|
+
|
|
533
|
+
#
|
|
534
|
+
###########################
|
|
535
|
+
def rerun_subscription_update
|
|
536
|
+
unless confirmed? "Delete and re-create the latest version of '#{cli_cmd.title}' via the subscription process?"
|
|
537
|
+
return
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
title = Xolo::Admin::Title.fetch cli_cmd.title, server_cnx
|
|
541
|
+
response_data = title.rerun_subscription_update server_cnx
|
|
542
|
+
|
|
543
|
+
show_debug "response_data: #{response_data}"
|
|
544
|
+
|
|
545
|
+
display_progress response_data[:progress_stream_url_path]
|
|
546
|
+
|
|
547
|
+
speak "Subscription update for latest version of '#{cli_cmd.title}' has been triggered."
|
|
530
548
|
rescue StandardError => e
|
|
531
549
|
handle_processing_error e
|
|
532
550
|
end
|
|
@@ -591,7 +609,7 @@ module Xolo
|
|
|
591
609
|
# but yes for edits.
|
|
592
610
|
upload_pkg(new_vers) unless title_obj.autopkg_enabled?
|
|
593
611
|
|
|
594
|
-
speak 'It can take
|
|
612
|
+
speak 'It can take 5-15 minutes (sometimes FAR longer) for the version to be available for use. Please do not release it before then'
|
|
595
613
|
rescue StandardError => e
|
|
596
614
|
handle_processing_error e
|
|
597
615
|
end
|
|
@@ -1000,7 +1018,7 @@ module Xolo
|
|
|
1000
1018
|
next
|
|
1001
1019
|
end
|
|
1002
1020
|
|
|
1003
|
-
vers =
|
|
1021
|
+
vers = d[:version]
|
|
1004
1022
|
version_counts[vers] ||= 0
|
|
1005
1023
|
version_counts[vers] += 1
|
|
1006
1024
|
end
|
data/lib/xolo/admin/title.rb
CHANGED
|
@@ -220,11 +220,18 @@ module Xolo
|
|
|
220
220
|
# @param cnx [Faraday::Connection] The connection to use, must be logged in already
|
|
221
221
|
# @return [Hash] the response data
|
|
222
222
|
#########################
|
|
223
|
-
def rerun_autopkg_recipe(
|
|
223
|
+
def rerun_autopkg_recipe(cnx = self.cnx)
|
|
224
224
|
resp = cnx.post "#{SERVER_ROUTE}/#{title}/rerun_autopkg_recipe", {}
|
|
225
225
|
resp.body
|
|
226
226
|
end
|
|
227
227
|
|
|
228
|
+
#
|
|
229
|
+
#########################
|
|
230
|
+
def rerun_subscription_update(cnx = self.cnx)
|
|
231
|
+
resp = cnx.post "#{SERVER_ROUTE}/#{title}/rerun-subscription", {}
|
|
232
|
+
resp.body
|
|
233
|
+
end
|
|
234
|
+
|
|
228
235
|
# Fetch the frozen computers for this title
|
|
229
236
|
# @param cnx [Faraday::Connection] The connection to use, must be logged in already
|
|
230
237
|
# @return [Hash{String => String}] computer name => user name
|
data/lib/xolo/admin/validate.rb
CHANGED
|
@@ -366,22 +366,37 @@ module Xolo
|
|
|
366
366
|
raise_invalid_data_error val, TITLE_ATTRS[:uninstall_script][:invalid_msg]
|
|
367
367
|
end
|
|
368
368
|
|
|
369
|
+
# validate a title's deprecated_lifetime:
|
|
370
|
+
# - a positive integer?
|
|
371
|
+
# OR
|
|
372
|
+
# - 'none' to unset the value
|
|
373
|
+
#
|
|
374
|
+
# @param val [Object] The value to validate
|
|
375
|
+
#
|
|
376
|
+
# @return [String] The valid value
|
|
377
|
+
#########################
|
|
378
|
+
def validate_deprecated_lifetime(val)
|
|
379
|
+
return if val == Xolo::NONE
|
|
380
|
+
return val.to_i if val.pix_integer? && val.to_i.positive?
|
|
381
|
+
|
|
382
|
+
raise_invalid_data_error val, TITLE_ATTRS[:deprecated_lifetime][:invalid_msg]
|
|
383
|
+
end
|
|
384
|
+
|
|
369
385
|
# validate a title auto_release_delay:
|
|
370
386
|
# - a non-negative integer?
|
|
371
387
|
# OR
|
|
388
|
+
# - 'monthly'
|
|
389
|
+
# OR
|
|
372
390
|
# - 'none' to unset the value
|
|
373
391
|
#
|
|
374
392
|
# @param val [Object] The value to validate
|
|
375
393
|
#
|
|
376
|
-
# @return [String
|
|
394
|
+
# @return [String] The valid value
|
|
377
395
|
###########################
|
|
378
|
-
def validate_auto_release_delay
|
|
396
|
+
def validate_auto_release_delay(val)
|
|
379
397
|
return if val == Xolo::NONE
|
|
380
|
-
|
|
381
|
-
if val.pix_integer?
|
|
382
|
-
val = val.to_i
|
|
383
|
-
return val unless val.negative?
|
|
384
|
-
end
|
|
398
|
+
return Xolo::MONTHLY if val.casecmp? Xolo::MONTHLY
|
|
399
|
+
return val if val.pix_integer? && !val.to_i.negative?
|
|
385
400
|
|
|
386
401
|
raise_invalid_data_error val, TITLE_ATTRS[:auto_release_delay][:invalid_msg]
|
|
387
402
|
end
|
|
@@ -953,6 +968,9 @@ module Xolo
|
|
|
953
968
|
# if targeting 'all' can't be in self-service
|
|
954
969
|
validate_title_consistency_no_all_in_ssvc(opts)
|
|
955
970
|
|
|
971
|
+
# if target_groups is set, release_group scan't be all, and vice versa
|
|
972
|
+
validate_title_consistency_no_tgt_groups_with_all(opts)
|
|
973
|
+
|
|
956
974
|
# if self-service category given, must be in self-service
|
|
957
975
|
validate_title_consistency_ssvc_needs_category(opts)
|
|
958
976
|
|
|
@@ -1197,7 +1215,7 @@ module Xolo
|
|
|
1197
1215
|
end
|
|
1198
1216
|
end
|
|
1199
1217
|
|
|
1200
|
-
# if
|
|
1218
|
+
# if release_groups is all, can't be in self service
|
|
1201
1219
|
#
|
|
1202
1220
|
# @param opts [OpenStruct] the current options
|
|
1203
1221
|
#
|
|
@@ -1208,13 +1226,33 @@ module Xolo
|
|
|
1208
1226
|
|
|
1209
1227
|
msg =
|
|
1210
1228
|
if walkthru?
|
|
1211
|
-
"Cannot be in Self Service when
|
|
1229
|
+
"Cannot be in Self Service when Release Group is '#{Xolo::TARGET_ALL}'"
|
|
1212
1230
|
else
|
|
1213
1231
|
"--self-service cannot be used when --release-groups contains '#{Xolo::TARGET_ALL}'"
|
|
1214
1232
|
end
|
|
1215
1233
|
raise_consistency_error msg
|
|
1216
1234
|
end
|
|
1217
1235
|
|
|
1236
|
+
# if target_groups is set, release_group scan't be all, and vice versa
|
|
1237
|
+
#
|
|
1238
|
+
# @param opts [OpenStruct] the current options
|
|
1239
|
+
#
|
|
1240
|
+
# @return [void]
|
|
1241
|
+
#######
|
|
1242
|
+
def validate_title_consistency_no_tgt_groups_with_all(opts)
|
|
1243
|
+
rel_all = opts[:release_groups].to_a.include?(Xolo::TARGET_ALL)
|
|
1244
|
+
got_tgts = !opts[:target_groups].pix_empty?
|
|
1245
|
+
return unless rel_all && got_tgts
|
|
1246
|
+
|
|
1247
|
+
msg =
|
|
1248
|
+
if walkthru?
|
|
1249
|
+
"Cannot use Target Group when Release Group is '#{Xolo::TARGET_ALL}'"
|
|
1250
|
+
else
|
|
1251
|
+
"--target-groups cannot be used when --release-groups contains '#{Xolo::TARGET_ALL}'"
|
|
1252
|
+
end
|
|
1253
|
+
raise_consistency_error msg
|
|
1254
|
+
end
|
|
1255
|
+
|
|
1218
1256
|
# if in self service, a category must be assigned
|
|
1219
1257
|
#
|
|
1220
1258
|
# @param opts [OpenStruct] the current options
|
data/lib/xolo/admin.rb
CHANGED
|
@@ -20,25 +20,33 @@
|
|
|
20
20
|
######
|
|
21
21
|
require 'openssl'
|
|
22
22
|
|
|
23
|
-
# Monkeypatch OpenSSL::SSL::SSLContext
|
|
24
|
-
#
|
|
23
|
+
# Monkeypatch/workaround so that OpenSSL::SSL::SSLContext ignores unexpected EOF errors...
|
|
24
|
+
# Seems to be a known problem with openssl v3.x
|
|
25
|
+
#
|
|
25
26
|
# see https://stackoverflow.com/questions/76183622/since-a-ruby-container-upgrade-we-expirience-a-lot-of-opensslsslsslerror
|
|
27
|
+
# and other googlings.
|
|
28
|
+
#
|
|
29
|
+
# In ruby 4.0 OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] is frozen so we have to .dup it
|
|
30
|
+
# to make the change.
|
|
31
|
+
#
|
|
32
|
+
# TODO: Remove this when the underlying problem is fixed, in either openssl itself, or
|
|
33
|
+
# the OpenSSL ruby module.
|
|
26
34
|
if OpenSSL::SSL.const_defined?(:OP_IGNORE_UNEXPECTED_EOF)
|
|
35
|
+
if OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.frozen?
|
|
36
|
+
# supress redefined const. warning
|
|
37
|
+
original_verbose = $VERBOSE
|
|
38
|
+
$VERBOSE = nil
|
|
39
|
+
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS = OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.dup
|
|
40
|
+
$VERBOSE = original_verbose
|
|
41
|
+
end
|
|
42
|
+
|
|
27
43
|
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_IGNORE_UNEXPECTED_EOF
|
|
28
44
|
end
|
|
29
45
|
|
|
30
|
-
require 'openssl'
|
|
31
46
|
require 'faraday'
|
|
32
47
|
require 'faraday/multipart'
|
|
33
48
|
require 'highline'
|
|
34
49
|
|
|
35
|
-
# Monkeypatch OpenSSL::SSL::SSLContext to ignore unexpected EOF errors
|
|
36
|
-
# happens with openssl v3 ??
|
|
37
|
-
# see https://stackoverflow.com/questions/76183622/since-a-ruby-container-upgrade-we-expirience-a-lot-of-opensslsslsslerror
|
|
38
|
-
if OpenSSL::SSL.const_defined?(:OP_IGNORE_UNEXPECTED_EOF)
|
|
39
|
-
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_IGNORE_UNEXPECTED_EOF
|
|
40
|
-
end
|
|
41
|
-
|
|
42
50
|
# Yes we're using a OpenStruct for our @opts, even though it's very slow.
|
|
43
51
|
# It isn't so slow that it's a problem for processing a CLI tool.
|
|
44
52
|
# The benefit is being able to use either Hash-style references
|
|
@@ -459,15 +459,17 @@ module Xolo
|
|
|
459
459
|
},
|
|
460
460
|
|
|
461
461
|
# @!attribute auto_release_delay
|
|
462
|
-
# @return [String] 'none' or an integer in string.
|
|
462
|
+
# @return [String] 'none', 'monthly', or an integer in string.
|
|
463
|
+
# How many days before new versions are automatically released?
|
|
463
464
|
# Applies only to subscribed titles with autopkg recipes.
|
|
464
465
|
auto_release_delay: {
|
|
465
466
|
label: 'Automatic Release Delay',
|
|
466
467
|
cli: :A,
|
|
467
468
|
type: :string,
|
|
468
469
|
walkthru_na: :auto_release_delay_na,
|
|
470
|
+
validate: true,
|
|
469
471
|
changelog: true,
|
|
470
|
-
invalid_msg: "Must be a non-negative integer, or '#{Xolo::NONE}'.",
|
|
472
|
+
invalid_msg: "Must be a non-negative integer, '#{Xolo::MONTHLY}', or '#{Xolo::NONE}'.",
|
|
471
473
|
desc: <<~ENDDESC
|
|
472
474
|
Specify how many days after a new version appears before it is automatically released from pilot.
|
|
473
475
|
|
|
@@ -477,6 +479,8 @@ module Xolo
|
|
|
477
479
|
|
|
478
480
|
Setting it to zero means that new versions will be released at the next nightly auto-release task. *** USE WITH EXTREME CAUTION ***
|
|
479
481
|
|
|
482
|
+
Setting it to '#{Xolo::MONTHLY}' will release it on whatever day of the month is defined in the Xolo server's 'auto_release_monthly' setting, or on the first day of the month if the server isn't set. The server may be set to a specific date, like '15' or to an ordinal-weekday, like '3rd Mon'.
|
|
483
|
+
|
|
480
484
|
To unset, meaning versions are never auto-released, use '#{Xolo::NONE}'
|
|
481
485
|
|
|
482
486
|
Auto-release happens during the server's nightly maintenance between 2-3am.
|
|
@@ -722,6 +726,25 @@ module Xolo
|
|
|
722
726
|
ENDDESC
|
|
723
727
|
},
|
|
724
728
|
|
|
729
|
+
# @!attribute deprecated_lifetime
|
|
730
|
+
# @return [Integer] How many days after deprecation before a version is automatically deleted from Xolo?
|
|
731
|
+
#
|
|
732
|
+
deprecated_lifetime: {
|
|
733
|
+
label: 'Deprecated Lifetime',
|
|
734
|
+
cli: :L,
|
|
735
|
+
validate: true,
|
|
736
|
+
type: :string,
|
|
737
|
+
changelog: true,
|
|
738
|
+
invalid_msg: "Invalid value. Must be a positive integer or 'none'",
|
|
739
|
+
desc: <<~ENDDESC
|
|
740
|
+
When a version is deprecated, it will be automatically deleted by the nightly maintenance this many days later. If set to 'none', deprecated versions will be auto-deleted based on the Xolo server settings.
|
|
741
|
+
|
|
742
|
+
Deprecated versions are those that have been released, but a newer version has been released since then.
|
|
743
|
+
|
|
744
|
+
This setting is especially useful for titles that have frequent versions, to avoid cluttering the xolo and Jamf servers with old versions.
|
|
745
|
+
ENDDESC
|
|
746
|
+
},
|
|
747
|
+
|
|
725
748
|
# @!attribute self_service
|
|
726
749
|
# @return [Boolean] Does this title appear in Self Service?
|
|
727
750
|
self_service: {
|
data/lib/xolo/core/constants.rb
CHANGED
data/lib/xolo/core/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xolo-admin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Chris Lasell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|