palo_alto 0.2.6 → 0.2.7

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.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PaloAlto
4
- VERSION = '0.2.6'
4
+ VERSION = '0.2.7'
5
5
  end
data/lib/palo_alto.rb CHANGED
@@ -189,6 +189,7 @@ module PaloAlto
189
189
 
190
190
  data = Nokogiri::XML.parse(text)
191
191
  unless data.xpath('//response/@status').to_s == 'success'
192
+ warn 'command failed'
192
193
  warn "sent:\n#{options.inspect}\n" if debug.include?(:sent_on_error)
193
194
  warn "received:\n#{text.inspect}\n" if debug.include?(:received_on_error)
194
195
  code = data.at_xpath('//response/@code')&.value.to_i # sometimes there is no code :( e.g. for 'op' errors
@@ -197,7 +198,6 @@ module PaloAlto
197
198
  end
198
199
 
199
200
  data
200
-
201
201
  rescue TemporaryException => e
202
202
  dont_retry_at = [
203
203
  'Partial revert is not allowed. Full system commit must be completed.',
@@ -236,12 +236,12 @@ module PaloAlto
236
236
  { 'shared-object': 'excluded' }
237
237
  ].compact } }
238
238
  end
239
- op.execute(cmd).tap do |result|
240
- if wait_for_completion
241
- job_id = result.at_xpath('response/result/job')&.text
242
- wait_for_job_completion(job_id) if job_id
243
- end
244
- end
239
+ result = op.execute(cmd)
240
+
241
+ return result unless wait_for_completion
242
+
243
+ job_id = result.at_xpath('response/result/job')&.text
244
+ wait_for_job_completion(job_id) if job_id
245
245
  end
246
246
 
247
247
  def full_commit_required?
@@ -378,7 +378,7 @@ module PaloAlto
378
378
 
379
379
  # attempt to obtain the auth_key
380
380
  # raise 'Exception attempting to obtain the auth_key' if (self.class.auth_key = get_auth_key).nil?
381
- self.get_auth_key
381
+ get_auth_key
382
382
  end
383
383
 
384
384
  # Perform a query to the API endpoint for an auth_key based on the credentials provided
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: palo_alto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Roesner
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-02 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri