palo_alto 0.1.3 → 0.1.4
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/palo_alto/config.rb +22 -15
- data/lib/palo_alto/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: be267a4c14845513d0ca0b93dcdf2673829983dbf58c6c321f57817bd30f3d82
|
4
|
+
data.tar.gz: 268e375e0f17b1b5eb1a7dea2fb838a7fe55047bfabe66def538f7afdaf8111f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f71277a31b9157ebee6b7045327998e483faa68329158d97d70deca570c5486c86eaf3505458b89275991bae635e8e0bdc99e8115b55356a5fcdf43fc32d96bb
|
7
|
+
data.tar.gz: '084b3b801f5c1390dd668bc45f1c29ddbe00202430c2f68baff227c469d8853575bcd14243c03823bb58f25b4175de2d26bf6f64280a56d2b2155d5e06444248'
|
data/lib/palo_alto/config.rb
CHANGED
@@ -436,7 +436,7 @@ module PaloAlto
|
|
436
436
|
self
|
437
437
|
end
|
438
438
|
|
439
|
-
def get(ignore_empty_result: false, xpath: self.to_xpath)
|
439
|
+
def get(ignore_empty_result: false, xpath: self.to_xpath, return_only: false)
|
440
440
|
if self.class.superclass == ArrayConfigClass && !@selector
|
441
441
|
raise(InvalidCommandException, "Please use 'get_all' here")
|
442
442
|
end
|
@@ -454,8 +454,11 @@ module PaloAlto
|
|
454
454
|
if ignore_empty_result==false
|
455
455
|
raise(ObjectNotPresentException, "empty result: #{payload.inspect}")
|
456
456
|
end
|
457
|
+
end
|
458
|
+
|
459
|
+
if return_only
|
460
|
+
data.xpath('//response/result/*')
|
457
461
|
else
|
458
|
-
#self.parent_instance.dup.create!.clear!.external_set(data.xpath('//response/result').first).first
|
459
462
|
@create_children=true
|
460
463
|
n = data.xpath('//response/result/*')
|
461
464
|
|
@@ -466,11 +469,13 @@ module PaloAlto
|
|
466
469
|
primary_key = get_primary_key(n.first.attribute_nodes, self.class.props)
|
467
470
|
set_array_class_attributes(n.first, primary_key) # primary key, api_attributes
|
468
471
|
end
|
472
|
+
|
473
|
+
self
|
474
|
+
end.tap do
|
475
|
+
if XML.debug.include?(:statistics)
|
476
|
+
puts "Elapsed for parsing: #{Time.now-start_time} seconds"
|
477
|
+
end
|
469
478
|
end
|
470
|
-
if XML.debug.include?(:statistics)
|
471
|
-
puts "Elapsed for parsing: #{Time.now-start_time} seconds"
|
472
|
-
end
|
473
|
-
self
|
474
479
|
end
|
475
480
|
|
476
481
|
def get_primary_key(attribute_nodes, props)
|
@@ -768,23 +773,25 @@ module PaloAlto
|
|
768
773
|
|
769
774
|
def set_xpath_from_selector(selector: @selector)
|
770
775
|
xpath = self.parent_instance.child(_section)
|
771
|
-
k,v=selector.first
|
776
|
+
k, v = selector.first
|
772
777
|
obj = xpath.where(PaloAlto.xpath_attr(k.to_sym) == v)
|
773
778
|
|
774
779
|
@expression = obj.expression
|
775
780
|
@arguments = obj.arguments
|
776
781
|
end
|
777
782
|
|
778
|
-
def rename!(new_name)
|
783
|
+
def rename!(new_name, internal_only: false)
|
779
784
|
# https://docs.paloaltonetworks.com/pan-os/10-1/pan-os-panorama-api/pan-os-xml-api-request-types/configuration-api/rename-configuration.html
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
785
|
+
unless internal_only
|
786
|
+
payload = {
|
787
|
+
type: 'config',
|
788
|
+
action: 'rename',
|
789
|
+
xpath: self.to_xpath,
|
790
|
+
newname: new_name
|
791
|
+
}
|
786
792
|
|
787
|
-
|
793
|
+
result = XML.execute(payload)
|
794
|
+
end
|
788
795
|
|
789
796
|
# now update also the internal value to the new name
|
790
797
|
self.selector.transform_values!{new_name}
|
data/lib/palo_alto/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.4
|
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-09-
|
11
|
+
date: 2021-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|