ruby-jss 1.2.4a4 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ruby-jss might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 745114754cc7073bbf494e8eb54f48962c9cafff99da985108c90b5bc7ccc62c
4
- data.tar.gz: 6455a7c53abc89c47a03b1bd9538bc0bd3375eab1776ca9c5a15425595ed2ed3
3
+ metadata.gz: 46f6f03d9aa4d1ddbbabc446004921fd6efa14fb36dcd30ae30dd968bae11357
4
+ data.tar.gz: 70d78adc1afe510511e5b678d1e852c1e9f518e9afd1e4109938696ddf3cd1f2
5
5
  SHA512:
6
- metadata.gz: 10cd851d966cc1e966dec194b27a4f282bba25b80177886dc03d44429206c8bc8bb223f141c9da27547f096a439937c6db3ae0d7e6498d2d6570b5bca164f716
7
- data.tar.gz: a194cd0e76b6264afc1deef0b2567169a83c7fba9aaad796f050171783df202d1fd3ccf04f5eb11606ea387badce68920822c698aab819bfb46a2fd2549a919f
6
+ metadata.gz: f631eade4108e9cd51022f417e775347bf1bd4467ab7567c5872d168d34f51908f80d164824571ead6e61ee8c4b8a9b5883db7537da0de66e7f6bc4298d2d4bc
7
+ data.tar.gz: d9d30e07a70cffa64f11facc41d4720f28a5ab081bf40af9bc3845fb7ed4e809e453ec1b4bad213e671a27191d3a5898c8b3861a6a98c102e80d9223a51df3de
data/CHANGES.md CHANGED
@@ -4,6 +4,49 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## \[1.2.6] - 2020-04-01
8
+
9
+ ### Fixed
10
+
11
+ - Classic API (JSS module)
12
+ - Sitable objects now recognize the string "None" as meaning no site is assigned. Thanks @cybertunnel for this fix!
13
+ - Scopable::Scope now deals with some bugs in the API regarding Jamf & LDAP users & user groups in targets, limitations, & exclusions. Please see the documentation/comments for the class in the file or the online documentation. Thanks @cybertunnel again!
14
+ - Criteriable::Criteria can now be empty - containing no criterion objects. When criteriable objects are created (such as Advanced Searches) the default JSS::Criteriable::Criteria object has no criteria. To remove all criteria, use `criteria.clear`, `criteria = nil`, or `criteria = JSS::Criteriable::Criteria.new` and then save. Once again, thanks to @cybertunnel for finding this.
15
+
16
+ - Jamf Pro API (Jamf module)
17
+ - More fixes for various JamfPro API (Jamf module) methods that accept a passed-in Jamf::Connection instance.
18
+
19
+
20
+ ## \[1.2.5] - 2020-03-30
21
+
22
+ ### Fixed
23
+
24
+ - Classic API (JSS module)
25
+ - The Classic API now requires JSS::User objects to be passed back to the API with the `ldap_server` specified by id, name-only won't work.
26
+
27
+ - Jamf Pro API (Jamf module)
28
+ - Fixes for various JamfPro API (Jamf module) methods that accept a passed-in Jamf::Connection instance.
29
+
30
+ ## \[1.2.4] - 2020-03-16
31
+
32
+ ### Added
33
+
34
+ - **'Beta' Jamf Pro API support in ruby-jss!**
35
+
36
+ The Jamf Pro API, formerly known as the 'Universal' API, aims to be a far more robust, modern, and standardized way to programmatically access a Jamf Pro server. While its been in development for a while, it is finally starting to settle in to some standards, to the point that its worth releasing some early ruby-jss code to access it.
37
+
38
+ Because the JP-API is so fundamentally different from the Classic API, it's being implemented as a totally separate ruby module 'Jamf', and many of the underlying standards of ruby-jss's JSS module are being re-thought and modernized, much like the JP-API itself. Classic API access using the JSS module is unchanged, and will continue to get fixes and other updates as needed. However many things in the Jamf module will behave differently from the JSS module, at least in detail if not concept.
39
+
40
+ For requirements and details of using the Jamf module to access the Jamf Pro API, see [lib/jamf/README-JP-API.md](lib/jamf/README-JP-API.md).
41
+
42
+ **IMPORTANT:** As with the JP-API, The Jamf module is an early work-in-progress, and things might change drastically at any point. Please mention 'ruby-jss' in MacAdmins Slack channels #jamf-api or #ruby, or email ruby-jss@pixar.com, or open an issue on github if you have questions or want to contribute.
43
+
44
+ ### Changed
45
+
46
+ - The `last_mdm_contact` class and instance method from the MDM mixin module (as used in Computer and MobileDevice classes) now returns the time of the most recent _completed_ or _failed_ mdm command. This is more accurate than just the completed commands, since a failed command still implies contact between the client and Jamf Pro.
47
+
48
+ - JSS::MobileDevice instances now have three predicate methods: `tv?` (aliased as `apple_tv?`), `ipad?` and `iphone?`
49
+
7
50
  ## \[1.2.3] - 2019-10-31
8
51
  ### Added
9
52
  - the ManagementHistory mixin module used by the Computer and MobileDevice classes, now has a `last_mdm_contact` class and instance method, which returns a Time object for the timestamp of the most recent completed MDM command. This is useful for MobileDevices, which don't have anything like the `last_checkin` value for comptuers, indicating real communication between the device and Jamf Pro.
data/README.md CHANGED
@@ -45,6 +45,8 @@ Hopefully others will find it useful, and add more to it as well.
45
45
 
46
46
  [Full technical documentation can be found here.](http://www.rubydoc.info/gems/ruby-jss/)
47
47
 
48
+ NOTE: ruby-jss 1.2.4 will introduce beta-level support for the Jamf Pro API in a ruby module called 'Jamf', See README-JP-API.md in /lib/jamf, or in the 'Files' section of the YARD docs file for details.
49
+
48
50
  ## SYNOPSIS
49
51
 
50
52
  Here are some simple examples of using ruby-jss
@@ -220,7 +220,7 @@ module Jamf
220
220
  val_is_str = value.is_a? String
221
221
 
222
222
  idents.each do |ident|
223
- match = all(cnx: cnx).select do |m|
223
+ match = all(refresh: refresh, cnx: cnx).select do |m|
224
224
  val_is_str ? m[ident].to_s.casecmp?(value) : m[ident] == value
225
225
  end.first
226
226
  return match[:id] if match
@@ -241,13 +241,20 @@ module Jamf
241
241
  end
242
242
 
243
243
  # Make a new thing to be added to the API
244
- def self.create(params, cnx: Jamf.cnx)
245
- raise Jamf::UnsupportedError, "#{self}'s are not currently creatable via the API" unless self.creatable?
246
-
244
+ def self.create(**params)
247
245
  validate_not_abstract
246
+ raise Jamf::UnsupportedError, "#{self}'s are not currently creatable via the API" unless creatable?
247
+
248
+ cnx = params.delete :cnx
249
+ cnx ||= Jamf.cnx
250
+
248
251
  params.delete :id # no such animal when .creating
249
252
 
250
- validate_create_params(params, cnx)
253
+ params.keys.each do |param|
254
+ raise ArgumentError, "Unknown parameter: #{param}" unless self::OBJECT_MODEL.key? param
255
+
256
+ params[param] = validate_attr param, params[param], cnx: cnx
257
+ end
251
258
 
252
259
  params[:creating_from_create] = true
253
260
  new params, cnx: cnx
@@ -277,16 +284,17 @@ module Jamf
277
284
  #
278
285
  def self.fetch(ident_value = nil, cnx: Jamf.cnx, **ident_hash)
279
286
  validate_not_abstract
287
+
280
288
  id =
281
289
  if ident_value == :random
282
290
  all_ids.sample
283
291
  elsif ident_value
284
- valid_id ident_value
292
+ valid_id ident_value, cnx: cnx
285
293
  elsif ident_hash.empty?
286
294
  nil
287
295
  else
288
296
  ident, lookup_value = ident_hash.first
289
- valid_id ident => lookup_value
297
+ valid_id ident => lookup_value, cnx: cnx
290
298
  end
291
299
 
292
300
  raise Jamf::NoSuchItemError, "No matching #{self}" unless id
@@ -362,17 +370,6 @@ module Jamf
362
370
  end # create_list_methods
363
371
  private_class_method :create_list_methods
364
372
 
365
- # validate that our .create data is OK
366
- #
367
- def self.validate_create_params(params, cnx)
368
- params.keys.each do |param|
369
- raise ArgumentError, "Unknown parameter: #{param}" unless self::OBJECT_MODEL.key? param
370
-
371
- params[param] = validate_attr param, params[param], cnx: cnx
372
- end
373
- end
374
- private_class_method :validate_create_params
375
-
376
373
  # Given an indentier attr. key, and a value,
377
374
  # return the id where that ident has that value, or nil
378
375
  #
@@ -482,7 +482,7 @@ module Jamf
482
482
  # have an alias without the 'is' so :isManaged will have
483
483
  # getters isManaged? and managed?
484
484
  #
485
- PREDICATE_RE = /^is([A-Z]\w*)$/.freeze
485
+ PREDICATE_RE = /^is([A-Z]\w+)$/.freeze
486
486
 
487
487
  # Public Class Methods
488
488
  #####################################
@@ -575,10 +575,11 @@ module Jamf
575
575
  else
576
576
  define_method(attr_name) { instance_variable_get("@#{attr_name}") }
577
577
 
578
- # all booleans get a predicate alias
579
- alias_method("#{attr_name}?", attr_name) if attr_def[:class] == :boolean
580
578
  end
581
579
 
580
+ # all booleans get predicate aliases
581
+ define_predicates(attr_name) if attr_def[:class] == :boolean
582
+
582
583
  return unless attr_def[:aliases]
583
584
 
584
585
  # aliases
@@ -586,6 +587,15 @@ module Jamf
586
587
  end # create getters
587
588
  private_class_method :create_getters
588
589
 
590
+ # create the default aliases for booleans
591
+ ##############################
592
+ def self.define_predicates(attr_name)
593
+ alias_method("#{attr_name}?", attr_name)
594
+ return unless attr_name.to_s =~ PREDICATE_RE
595
+
596
+ alias_method("#{Regexp.last_match(1).downcase}?", attr_name)
597
+ end
598
+
589
599
  # create setter(s) for an attribute, and any aliases needed
590
600
  ##############################
591
601
  def self.create_setters(attr_name, attr_def)
@@ -48,7 +48,7 @@ module Jamf
48
48
  RSRC_BASE = 'uapi'.freeze
49
49
 
50
50
  # The API version must be this or higher
51
- MIN_API_VERSION = Gem::Version.new('1.0')
51
+ MIN_JAMF_VERSION = Gem::Version.new('10.15.0')
52
52
 
53
53
  HTTPS_SCHEME = 'https'.freeze
54
54
 
@@ -111,6 +111,7 @@ module Jamf
111
111
  @login_time
112
112
  @keep_alive
113
113
  @token_refresh
114
+ @pw_fallback
114
115
  ].freeze
115
116
 
116
117
  # Attributes
@@ -140,6 +141,10 @@ module Jamf
140
141
  # @return [String, nil]
141
142
  attr_reader :base_url
142
143
 
144
+ # @return [Boolean] if token refresh/keepaliave fails, try to get a new one
145
+ # with the passwd used with .connect. Defaults to true
146
+ attr_reader :pw_fallback
147
+
143
148
  # @return [Boolean]
144
149
  attr_reader :connected
145
150
  alias connected? connected
@@ -227,14 +232,13 @@ module Jamf
227
232
  # ### Tokens
228
233
  # Instead of a user and password, you may specify a valid 'token:', either:
229
234
  #
230
- # A Jamf::Connection::Token object, which can be extracted from an active
235
+ # A Jamf::Connection::Token object, which can be extracted from an active
231
236
  # Jamf::Connection via its #token method
232
237
  #
233
238
  # or
234
239
  #
235
240
  # A token string e.g. "eyJhdXR...6EKoo" from any source can also be used.
236
241
  #
237
- #
238
242
  # Any values available via Jamf.config will be used if they are not provided
239
243
  # in the parameters.
240
244
  #
@@ -251,6 +255,19 @@ module Jamf
251
255
  #
252
256
  # @param token: [Jamf::Connection::Token, String] An existing, valid token.
253
257
  # When used, there's no need to provide user: or pw:.
258
+ # NOTE if using pw_fallback:true (the default) while providing a token
259
+ # you will also need to provide the password for the token user in the pw:
260
+ # parameter, or be prompted for it. If you don't have the pw for the
261
+ # token user, be sure to set pw_fallback to false.
262
+ #
263
+ # @param token_refresh: [Integer] Refresh the token this many seconds before
264
+ # it expires. Must be >= DFT_TOKEN_REFRESH
265
+ #
266
+ # @pararm pw_fallback: [Boolean] Default is true. Use the password provided
267
+ # to refresh the token if regular refresh doesn't work (e.g. token is expired).
268
+ # NOTE: This causes the password to be kept in memory. If you don't want
269
+ # this, explicitly set pw_fallback to false, however long-running processes
270
+ # may lose connection if token refresh fails for any reason.
254
271
  #
255
272
  # @param open_timeout: [Integer] The number of seconds for initial contact
256
273
  # with the host.
@@ -268,7 +285,8 @@ module Jamf
268
285
  # This sets all the instance vars to nil, and flushes/creates the caches
269
286
  disconnect
270
287
 
271
- # This sets @token, and adds host, port, user to params from a Token object
288
+ # If there's a Token object in :token, this sets @token,
289
+ # and adds host, port, user from that token
272
290
  parse_token params
273
291
 
274
292
  # Get host, port, user and pw from a URL, add to params if needed
@@ -277,6 +295,8 @@ module Jamf
277
295
  # apply defaults from config, client, and then this class.
278
296
  apply_connection_defaults params
279
297
 
298
+ # Once we're here, all params have been parsed & defaulted into the
299
+ # params hash, so
280
300
  # make sure we have the minimum needed params for a connection
281
301
  verify_basic_params params
282
302
 
@@ -285,15 +305,20 @@ module Jamf
285
305
 
286
306
  # if no @token already, get one from from
287
307
  # either a token string or a pw
288
- @token ||=
308
+ unless @token
289
309
  if params[:token].is_a? String
290
- tk = token_from :token_string, params[:token]
310
+ @token = token_from :token_string, params[:token]
291
311
  # get the user from the token
292
- @user = tk.user
293
- tk
312
+ @user = @toke.user
313
+ # if @pw_fallback, the pw must be acquired, since it isn't in
314
+ # the token
315
+ @pw = acquire_password(params[:pw]) if @pw_fallback
294
316
  else
295
- token_from :pw, acquire_password(params[:pw])
317
+ pw = acquire_password(params[:pw])
318
+ @token = token_from :pw, pw
319
+ @pw = pw if @pw_fallback
296
320
  end
321
+ end
297
322
 
298
323
  # Now get some values from our token
299
324
  @base_url = @token.base_url
@@ -303,43 +328,49 @@ module Jamf
303
328
  @rest_cnx = create_connection
304
329
 
305
330
  # make sure versions are good
306
- validate_api_version
331
+ validate_jamf_version
307
332
 
308
333
  @connected = true
309
334
 
310
335
  # start keepalive if needed
311
- @keep_alive = params[:keep_alive].nil? ? false : params[:keep_alive]
312
336
  start_keep_alive if @keep_alive
313
337
 
314
338
  # return our string output
315
339
  to_s
316
340
  end # connect
317
341
 
342
+ # reset all values to nil or empty
318
343
  def disconnect
319
- # reset everything except the timeouts
320
- stop_keep_alive
321
-
322
344
  @connected = false
323
345
  @name = NOT_CONNECTED
324
346
  @login_time = nil
347
+
348
+ stop_keep_alive
349
+
325
350
  @host = nil
326
351
  @port = nil
327
352
  @user = nil
328
- @token = nil
353
+ @timeout = nil
354
+ @open_timeout = nil
329
355
  @base_url = nil
356
+ @token = nil
330
357
  @rest_cnx = nil
331
358
  @ssl_options = {}
332
359
  @keep_alive = nil
360
+ @token_refresh = nil
361
+ @pw_fallback = nil
362
+ @pw = nil
333
363
 
334
364
  flushcache
335
365
  end
336
366
 
337
- # Same as disconnect, but invalidates the token
367
+ # Same as disconnect, but invalidates the token on the server first
338
368
  def logout
339
369
  @token.destroy
340
370
  disconnect
341
371
  end
342
372
 
373
+ # Get a resource
343
374
  def get(rsrc)
344
375
  validate_connected
345
376
  resp = @rest_cnx.get rsrc
@@ -461,8 +492,12 @@ module Jamf
461
492
  @token_refresh = secs
462
493
  end
463
494
 
464
- def api_version
465
- @token.api_version
495
+ def jamf_version
496
+ @token.jamf_version
497
+ end
498
+
499
+ def jamf_build
500
+ @token.jamf_build
466
501
  end
467
502
 
468
503
  # Flush the collection and/or ea cache for the given class,
@@ -503,11 +538,11 @@ module Jamf
503
538
  end
504
539
 
505
540
  # raise exception if API version is too low.
506
- def validate_api_version
507
- vers = api_version
508
- return if Gem::Version.new(vers) >= MIN_API_VERSION
541
+ def validate_jamf_version
542
+ vers = jamf_version
543
+ return if Gem::Version.new(vers) >= MIN_JAMF_VERSION
509
544
 
510
- raise Jamf::InvalidConnectionError, "API version '#{vers}' too low, must be >= '#{MIN_API_VERSION}'"
545
+ raise Jamf::InvalidConnectionError, "API version '#{vers}' too low, must be >= '#{MIN_JAMF_VERSION}'"
511
546
  end
512
547
 
513
548
  ##### Parse Params
@@ -537,7 +572,7 @@ module Jamf
537
572
  raise "Cannot use token: it expires in less than #{TOKEN_REUSE_MIN_LIFE} seconds" if token.secs_remaining < TOKEN_REUSE_MIN_LIFE
538
573
  end
539
574
 
540
- # Get host, port, user and pw from a URL, unless they are already in the params
575
+ # Get host, port, user and pw from a URL, overriding any already in the params
541
576
  #
542
577
  # @return [String, nil] the pw if present
543
578
  #
@@ -547,27 +582,29 @@ module Jamf
547
582
  url = URI.parse url.to_s
548
583
  raise ArgumentError, 'Invalid url, scheme must be https' unless url.scheme == HTTPS_SCHEME
549
584
 
550
- params[:host] ||= url.host
551
- params[:port] ||= url.port
552
- params[:user] ||= url.user if url.user
553
- params[:pw] ||= url.password if url.password
585
+ params[:host] = url.host
586
+ params[:port] = url.port
587
+ params[:user] = url.user if url.user
588
+ params[:pw] = url.password if url.password
554
589
  end
555
590
 
556
- # Apply defaults from the Jamf.config,
557
- # then from the Jamf::Client,
591
+ # Apply defaults to the unset params for the #connect method
592
+ # First apply them from from the Jamf.config,
593
+ # then from the Jamf::Client (read from the jamf binary config),
558
594
  # then from the Jamf module defaults
559
- # to the unset params for the #connect method
560
595
  #
561
596
  # @param params[Hash] The params for #connect
562
597
  #
563
598
  # @return [Hash] The params with defaults applied
564
599
  #
565
600
  def apply_connection_defaults(params)
566
- # if no port given, either directly or via URL, and the host
567
- # is a jamfcloud host, always set the port to 443
568
- # This should happen before the config is applied, so
569
- # on-prem users can still get to jamfcoud without specifying the port
570
- params[:port] = JAMFCLOUD_PORT if params[:port].nil? && params[:host].to_s.end_with?(JAMFCLOUD_DOMAIN)
601
+ # must have a host, but accept legacy :server as well as :host
602
+ params[:host] ||= params[:server]
603
+
604
+ # if we have no port set by this point, set to cloud port
605
+ # if host is a cloud host. But leave port nil for other hosts
606
+ # (will be set via client defaults or module defaults)
607
+ params[:port] ||= JAMFCLOUD_PORT if params[:host].to_s.end_with?(JAMFCLOUD_DOMAIN)
571
608
 
572
609
  apply_defaults_from_config(params)
573
610
 
@@ -621,11 +658,12 @@ module Jamf
621
658
  # @return [Hash] The params with defaults applied
622
659
  #
623
660
  def apply_module_defaults(params)
624
- # if we have no port set by this point, assume on-prem
661
+ # if we have no port set by this point, assume on-prem.
625
662
  params[:port] ||= ON_PREM_SSL_PORT
626
663
  params[:timeout] ||= DFT_TIMEOUT
627
664
  params[:open_timeout] ||= DFT_OPEN_TIMEOUT
628
665
  params[:ssl_version] ||= DFT_SSL_VERSION
666
+ params[:token_refresh] ||= DFT_TOKEN_REFRESH
629
667
  # if we have a TTY, pw defaults to :prompt
630
668
  params[:pw] ||= :prompt if STDIN.tty?
631
669
  end
@@ -641,36 +679,38 @@ module Jamf
641
679
  # and is already parsed
642
680
  return if @token
643
681
 
644
- # must have a host, but accept legacy :server as well as :host
645
- params[:host] ||= params[:server]
682
+ # must have a host
646
683
  raise Jamf::MissingDataError, 'No Jamf :host specified, or in configuration.' unless params[:host]
647
684
 
648
685
  # no need for user or pass if using a token string
649
686
  return if params[:token].is_a? String
650
687
 
688
+ # must have user and pw
651
689
  raise Jamf::MissingDataError, 'No Jamf :user specified, or in configuration.' unless params[:user]
652
690
  raise Jamf::MissingDataError, "No :pw specified for user '#{params[:user]}'" unless params[:pw]
653
691
  end
654
692
 
693
+ # Turn the connection parameters into instance vars
655
694
  def parse_connect_params(params)
656
695
  @host = params[:host]
657
696
  @port = params[:port]
658
- @port ||= @host.end_with?(JAMFCLOUD_DOMAIN) ? JAMFCLOUD_PORT : ON_PREM_SSL_PORT
659
697
  @user = params[:user]
660
698
 
661
- @token_refresh = params[:token_refresh].to_i || DFT_TOKEN_REFRESH
662
- # token refresh must be at least DFT_TOKEN_REFRESH
663
- @token_refresh = DFT_TOKEN_REFRESH if @token_refresh < DFT_TOKEN_REFRESH
699
+ @keep_alive = params[:keep_alive].nil? ? false : params[:keep_alive]
700
+ @pw_fallback = params[:pw_fallback].nil? ? true : params[:pw_fallback]
701
+ @token_refresh = params[:token_refresh].to_i
664
702
 
665
- @timeout = params[:timeout] || DFT_TIMEOUT
666
- @open_timeout = params[:open_timeout] || DFT_TIMEOUT
703
+ @timeout = params[:timeout]
704
+ @open_timeout = params[:open_timeout]
667
705
  @base_url = URI.parse "https://#{@host}:#{@port}/#{RSRC_BASE}"
706
+
668
707
  # ssl opts for faraday
669
708
  # TODO: implement all of faraday's options
670
709
  @ssl_options = {
671
710
  verify: params[:verify_cert],
672
711
  version: params[:ssl_version]
673
712
  }
713
+
674
714
  @name = "#{@user}@#{@host}:#{@port}" if @name == NOT_CONNECTED
675
715
  end
676
716
 
@@ -701,16 +741,18 @@ module Jamf
701
741
  # @return [String] The password for the connection
702
742
  #
703
743
  def acquire_password(param_pw)
704
- if param_pw == :prompt
705
- Jamf.prompt_for_password "Enter the password for Jamf user #{@user}@#{@host}:"
706
- elsif param_pw.is_a?(Symbol) && param_pw.to_s.start_with?('stdin')
707
- param_pw.to_s =~ /^stdin(\d+)$/
708
- line = Regexp.last_match(1)
709
- line ||= 1
710
- Jamf.stdin line
711
- else
712
- param_pw
713
- end # if
744
+ pw =
745
+ if param_pw == :prompt
746
+ Jamf.prompt_for_password "Enter the password for Jamf user #{@user}@#{@host}:"
747
+ elsif param_pw.is_a?(Symbol) && param_pw.to_s.start_with?('stdin')
748
+ param_pw.to_s =~ /^stdin(\d+)$/
749
+ line = Regexp.last_match(1)
750
+ line ||= 1
751
+ Jamf.stdin line
752
+ else
753
+ param_pw
754
+ end # if
755
+ pw
714
756
  end # acquire pw
715
757
 
716
758
  # create the faraday connection object
@@ -747,11 +789,11 @@ module Jamf
747
789
  begin
748
790
  next if @token.secs_remaining > @token_refresh
749
791
 
750
- @token.refresh
792
+ @token.refresh @pw
751
793
  # make sure faraday uses the new token
752
794
  @rest_cnx.headers[:authorization] = @token.auth_token
753
795
  rescue
754
- # TODO: Some kind of error reporting??
796
+ # TODO: Some kind of error reporting
755
797
  next
756
798
  end
757
799
  end # loop