xolo-admin 2.0.3 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8637742b96fa6e20b3d2d781f6c3e6d7c19cf0fbaa9bd4d39625cf9738f06845
4
- data.tar.gz: af15092c906bd833441229bccc8d2944b99dbc035fc29a6ddcb3985979ab4f77
3
+ metadata.gz: ace6e6d8f0ac4d0ed085f2037803869d1b35ea3ff4efb53b3651dc3faafa5c25
4
+ data.tar.gz: 39cae6de70ea1a0e90c9a12e2e80b4502b27715bfcedbbf991b1239eec69bb1c
5
5
  SHA512:
6
- metadata.gz: d73169bf141bf0d98d2b05c586673e073d2d43785418bbfe57c34a4876637f1e6fca2e5b91f3739ec35d563bc4d254e57f58d6e61d629814ed5f47bfe750e2d9
7
- data.tar.gz: a7edfa0ddc811772c3dc12c3621bdf200b01630f4c0605190ee8c07e4abbb7065bda17be11cf0dd3857dfb5b302a60641225a4cbd2397a5fbae0de1758f9dba4
6
+ metadata.gz: '059aa31ea917298e5aef01c64625b9fa8b1b539c181217ec7dffbfcc51e334c4d0e2ee43dff2e9d4908ddd9867a0b8c1c683685c9039300283f9d99c37b7d159'
7
+ data.tar.gz: 5dbc53d110470af587c234efebd060baf590872f17613ef5c3dc688a3bde85a94e544e6824ec92cc428b5352d2c4b93a6483bc27fa3e5c6c24579cdb48ff4c65
data/data/client/xolo CHANGED
@@ -162,6 +162,8 @@ Commands:
162
162
  install, i <title>[=<version>] [<title2>[=<version2>] ...]
163
163
  Install a title, or specific version thereof (e.g. a version currently in pilot)
164
164
  If no version is specified, the currently released version will be installed.
165
+ If you are only installing only one specific version of one title, you can
166
+ omit the =, e.g. install <title> <version>.
165
167
 
166
168
  uninstall, u <title> [<title2> ...]
167
169
  Uninstall a title, if possible. Not all titles are uninstallable via xolo.
@@ -255,8 +257,24 @@ function parse_cli() {
255
257
  command=$1
256
258
  [[ ${#@} -gt 0 ]] && shift
257
259
 
260
+ # the remaining positional parameters as an array called targets
261
+ # It'll either be exactly 1 item: title
262
+ # or exactly 2 items containing no '=' : title, version
263
+ # or exactly 2 items containing no '=' : title, title
264
+ # or any number if items in the form: title[=version] where the =version is optional.
258
265
  targets=("${(@)@}")
259
266
 
267
+ # if targets has exactly 2 items, and neither of them contains
268
+ # '=' and the second one isn't an existing title then treat
269
+ # them as the title and a version and reset 'targets' to be 'title=version'
270
+ if [[ "$#targets" == 2 ]] \
271
+ && [[ "$targets[1]" != *"$TITLE_VERSION_SEPARATOR"* ]] \
272
+ && [[ "$targets[2]" != *"$TITLE_VERSION_SEPARATOR"* ]] \
273
+ && ! echo "$(all_xolo_titles)" | grep -qE "^${targets[2]}$" ; then
274
+
275
+ targets=("$targets[1]=$targets[2]")
276
+ fi
277
+
260
278
  debug "Parsed command line:"
261
279
  debug "..show_help is: $show_help"
262
280
  debug "..be_verbose is: $be_verbose"
@@ -275,6 +293,9 @@ function parse_cli() {
275
293
  #################################
276
294
  function parse_title_and_version() {
277
295
  local arg=$1
296
+ unset title_is_valid
297
+ unset version_is_valid
298
+
278
299
  debug "Parsing title and version from arg: '$arg'"
279
300
 
280
301
  if [[ "$arg" == *"$TITLE_VERSION_SEPARATOR"* ]] ; then
@@ -786,9 +807,13 @@ function refresh_client_data() {
786
807
  # validate that the title exists
787
808
  ###############################
788
809
  function validate_title() {
810
+
789
811
  # if we've already validated the title, we're done
790
812
  [[ -n "$title_is_valid" ]] && return
791
813
 
814
+ # use passed arg if needed
815
+ [[ -z "$title" ]] && title=$1
816
+
792
817
  debug "Validating title: $title"
793
818
 
794
819
  # die if no title given
@@ -823,7 +848,7 @@ function validate_version() {
823
848
  all_versions=$(versions_for_title $title)
824
849
  debug "All versions for title $title:\n$all_versions"
825
850
  # [[ $all_versions =~ (^|\n)$version($|\n) ]] || die "No such version: $version"
826
- echo "$all_versions" | grep -q "^$version$" || die "No such version: $version"
851
+ echo "$all_versions" | grep -q "^$version$" || die "No such version '$version' for title '$title'"
827
852
  version_is_valid=1
828
853
  }
829
854
 
@@ -398,6 +398,7 @@ module Xolo
398
398
  opt opt_key, desc, short: deets[:cli], type: type, required: required, multi: deets[:multi]
399
399
  end # opts_to_use.each
400
400
  end # if cmd_opts
401
+ conflicts :subscribed, :managed if cmd == Xolo::Admin::Options::LIST_TITLES_CMD
401
402
  end # Optimist.options
402
403
  end
403
404
 
@@ -198,6 +198,52 @@ module Xolo
198
198
  TARGET_TITLE_PLACEHOLDER = Xolo::Admin::Title::TARGET_TITLE_PLACEHOLDER
199
199
  TARGET_VERSION_PLACEHOLDER = 'TARGET_VERSION_PH'
200
200
 
201
+ LIST_TITLES_OPTIONS = {
202
+ subscribed: {
203
+ label: 'Subscribed Only',
204
+ cli: :s,
205
+ type: :boolean,
206
+ validate: :validate_boolean,
207
+ default: false,
208
+ desc: <<~ENDDESC
209
+ Show only 'subscribed' titles. Can be combined with --autopkg.
210
+ ENDDESC
211
+ },
212
+
213
+ managed: {
214
+ label: 'Managed Only',
215
+ cli: :m,
216
+ type: :boolean,
217
+ validate: :validate_boolean,
218
+ default: false,
219
+ desc: <<~ENDDESC
220
+ Show only 'managed' titles. Can be combined with --autopkg.
221
+ ENDDESC
222
+ },
223
+
224
+ autopkg: {
225
+ label: 'AutoPkg Only',
226
+ cli: :a,
227
+ type: :boolean,
228
+ validate: :validate_boolean,
229
+ default: false,
230
+ desc: <<~ENDDESC
231
+ Show only titles configured for AutoPkg. Can be combined with --subscribed or --managed.
232
+ ENDDESC
233
+ },
234
+
235
+ pilots: {
236
+ label: 'Pilots Only',
237
+ cli: :p,
238
+ type: :boolean,
239
+ validate: :validate_boolean,
240
+ default: false,
241
+ desc: <<~ENDDESC
242
+ Show only titles with pending pilot (un-released) versions. Use 'list-versions' to see details for a title. Can be combined with --subscribed or --managed.
243
+ ENDDESC
244
+ }
245
+ }.freeze
246
+
201
247
  PATCH_REPORT_OPTIONS = {
202
248
  summary: {
203
249
  label: 'Summary Only',
@@ -410,7 +456,7 @@ module Xolo
410
456
  LIST_TITLES_CMD => {
411
457
  desc: 'List all software titles.',
412
458
  display: LIST_TITLES_CMD,
413
- opts: {},
459
+ opts: LIST_TITLES_OPTIONS,
414
460
  arg_banner: :none,
415
461
  process_method: :list_titles,
416
462
  target: :none
@@ -211,16 +211,27 @@ module Xolo
211
211
  return
212
212
  end
213
213
 
214
- report_title = 'All titles in Xolo'
215
- header = %w[Title Created By SSvc? Released Latest]
214
+ type = opts_to_process.subscribed ? ' subscribed' : nil
215
+ type ||= opts_to_process.managed ? ' managed' : nil
216
+ autopkg = opts_to_process.autopkg ? ' autopkg' : nil
217
+ pilots = opts_to_process.pilots ? ' with unreleased pilots' : nil
218
+
219
+ report_title = "All#{type}#{autopkg} titles in Xolo#{pilots}"
220
+
221
+ titles.select! { |t| t.subscribed? } if opts_to_process.subscribed
222
+ titles.reject! { |t| t.subscribed? } if opts_to_process.managed
223
+ titles.select! { |t| t.autopkg_recipe } if opts_to_process.autopkg
224
+ titles.select! { |t| pending_pilots? t } if opts_to_process.pilots
225
+
226
+ header = %w[Title Created By SSvc? Latest Released]
216
227
  data = titles.map do |t|
217
228
  [
218
229
  t.title,
219
230
  t.creation_date.to_date,
220
231
  t.created_by,
221
232
  t.self_service || false,
222
- t.released_version,
223
- t.latest_version
233
+ t.latest_version,
234
+ t.released_version
224
235
  ]
225
236
  end
226
237
  data.sort_by! { |d| d[0].downcase } # sort by title
@@ -230,6 +241,16 @@ module Xolo
230
241
  handle_processing_error e
231
242
  end
232
243
 
244
+ # @param title [Xolo::Admin::Title] The title in question
245
+ # @return [Boolean] Does a given Title object have pilots?
246
+ ###########################
247
+ def pending_pilots?(title)
248
+ return false if title.version_order.pix_empty?
249
+ return false if title.released_version == title.version_order.first
250
+
251
+ true
252
+ end
253
+
233
254
  # Add a title to Xolo
234
255
  #
235
256
  # @return [void]
@@ -487,16 +508,19 @@ module Xolo
487
508
  return
488
509
  end
489
510
 
490
- report_title = "All versions of '#{cli_cmd.title}' in Xolo"
511
+ report_title = "All versions of '#{cli_cmd.title}' in Xolo. ** = No .pkg uploaded"
491
512
  header = %w[Vers Created By Released By Status]
492
513
  data = versions.sort_by(&:creation_date).map do |v|
514
+ no_pkg = v.pkg_to_upload.pix_empty? && v.jamf_pkg_file.pix_empty?
515
+ status = no_pkg ? "#{v.status} **" : v.status
516
+
493
517
  [
494
518
  v.version,
495
519
  v.creation_date.to_date,
496
520
  v.created_by,
497
521
  v.release_date&.to_date,
498
522
  v.released_by,
499
- v.status
523
+ status
500
524
  ]
501
525
  end
502
526
  show_text generate_report(data, header_row: header, title: report_title)
@@ -12,7 +12,7 @@ module Xolo
12
12
 
13
13
  module Version
14
14
 
15
- VERSION = '2.0.3'.freeze
15
+ VERSION = '2.1.0'.freeze
16
16
 
17
17
  end
18
18
 
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.0.3
4
+ version: 2.1.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-07-25 00:00:00.000000000 Z
11
+ date: 2026-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday