ruby-paloalto-client 0.0.2 → 0.0.3
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a06152dd488c1a8d36ac2f47ac28670bfde84fcb
|
4
|
+
data.tar.gz: 7e164cad49c518012be0200af326ef2a9e0b8c4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80a24f2db0629f423b871310a0c1028eb5c399c78e246629f66a79261e621dc65bae522a0aeba7d5a1782101b19159d42263929c92324e71edf34821131311bd
|
7
|
+
data.tar.gz: bea1dea302b1fbabd9ad0e19ee58c506419980988f08bd58eaac3b77bb5c1ebdd38799f5c4af2f5fc1a2fdd7dc3faeae9803c0f4b0318c82b12cfd8de7a30204
|
@@ -3,7 +3,7 @@ module PaloAlto
|
|
3
3
|
class LogEntry
|
4
4
|
attr_accessor :log_id, :serial, :seqno, :type
|
5
5
|
|
6
|
-
SUPPORTED_TYPES = [ "traffic", "system"
|
6
|
+
SUPPORTED_TYPES = [ "traffic", "system" ]
|
7
7
|
|
8
8
|
# Create and returns a new PaloAlto::Models::LogEntry instance with the given parameters
|
9
9
|
#
|
@@ -46,8 +46,10 @@ module PaloAlto
|
|
46
46
|
|
47
47
|
# get all address group members for the virtual system
|
48
48
|
vsys_entry.xpath('address-group/entry').each do |address_group_entry|
|
49
|
+
# handle an optional 'description' parameter
|
50
|
+
description = (desc_xpath = address_group_entry.xpath('description')).empty? ? "" : desc_xpath.first.content
|
49
51
|
address_group = PaloAlto::Models::AddressGroup.new(name: address_group_entry.xpath('@name').to_s,
|
50
|
-
description:
|
52
|
+
description: description)
|
51
53
|
|
52
54
|
# associate addresses with the address group
|
53
55
|
address_group_entry.xpath('*/member').each do |address_entry|
|
@@ -71,16 +71,6 @@ describe "PaloAlto::Models::LogEntry" do
|
|
71
71
|
expect(PaloAlto::Models::LogEntry.from_xml(xml_data: system_log_xml)).to be_instance_of(PaloAlto::Models::SystemLogEntry)
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
75
|
-
describe "for data logs" do
|
76
|
-
let(:data_log_xmlfile) { File.open(fixture_file("data_logs.xml")).read }
|
77
|
-
let(:data_log_nokogiri) { Nokogiri::XML(data_log_xmlfile) }
|
78
|
-
let(:data_log_xml) { data_log_nokogiri.xpath('//response/result/log/logs/*')[0] }
|
79
|
-
|
80
|
-
it "returns a PaloAlto::Models::DataLogEntry instance" do
|
81
|
-
expect(PaloAlto::Models::LogEntry.from_xml(xml_data: data_log_xml)).to be_instance_of(PaloAlto::Models::DataLogEntry)
|
82
|
-
end
|
83
|
-
end
|
84
74
|
end
|
85
75
|
end
|
86
76
|
end
|
@@ -17,11 +17,12 @@ describe "PaloAlto::V6::VirtualSystemApi" do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
describe ".virtual_systems" do
|
20
|
-
let(:virtual_system_xml)
|
21
|
-
let(:blank_virtual_system_xml)
|
22
|
-
let(:no_rulebase_virtual_system_xml)
|
23
|
-
let(:no_address_virtual_system_xml)
|
24
|
-
let(:no_address_group_virtual_system_xml)
|
20
|
+
let(:virtual_system_xml) { File.open(fixture_file("virtual_systems.xml")).read }
|
21
|
+
let(:blank_virtual_system_xml) { File.open(fixture_file("blank_virtual_systems.xml")).read }
|
22
|
+
let(:no_rulebase_virtual_system_xml) { File.open(fixture_file("no_rulebase_virtual_systems.xml")).read }
|
23
|
+
let(:no_address_virtual_system_xml) { File.open(fixture_file("no_address_virtual_systems.xml")).read }
|
24
|
+
let(:no_address_group_virtual_system_xml) { File.open(fixture_file("no_address_group_virtual_systems.xml")).read }
|
25
|
+
let(:blank_address_group_description_virtual_system_xml) { File.open(fixture_file("address_group_missing_description.xml")).read }
|
25
26
|
|
26
27
|
describe "when virtual systems exist" do
|
27
28
|
it "parses the XML response into the required format" do
|
@@ -65,6 +66,13 @@ describe "PaloAlto::V6::VirtualSystemApi" do
|
|
65
66
|
|
66
67
|
expect(@virtual_systems[0].address_groups[0].addresses).to_not be_empty
|
67
68
|
end
|
69
|
+
|
70
|
+
it "assigns a blank 'description' when the address group has no description" do
|
71
|
+
expect(PaloAlto::Helpers::Rest).to receive(:make_request).and_return(blank_address_group_description_virtual_system_xml)
|
72
|
+
@virtual_systems = DummyClass.virtual_systems
|
73
|
+
|
74
|
+
expect(@virtual_systems[0].address_groups[0].description).to eq("")
|
75
|
+
end
|
68
76
|
end
|
69
77
|
end
|
70
78
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-paloalto-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Karimi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|