Skip to content

Commit 557a7fa

Browse files
committed
Merge branch 'release/0.4.1'
2 parents 2a70d86 + dbc61de commit 557a7fa

File tree

5 files changed

+31
-11
lines changed

5 files changed

+31
-11
lines changed

HISTORY.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
History
44
=======
55

6+
0.4.1
7+
-----
8+
9+
Released: 2017-05-12
10+
11+
Status: Alpha
12+
13+
- Add: Support new HA error added in PAN-OS 7.1
14+
- Fix: Issue where existing references are sometimes removed when adding a new reference
15+
- Fix: AttributeError on None when refreshing device-groups and none exist yet
16+
617
0.4.0
718
-----
819

pandevice/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
__author__ = 'Palo Alto Networks'
2525
__email__ = '[email protected]'
26-
__version__ = '0.4.0'
26+
__version__ = '0.4.1'
2727

2828

2929
import logging

pandevice/base.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,6 +1121,9 @@ def refreshall_from_xml(self, xml, refresh_children=True, variables=None):
11211121
"""
11221122
instances = []
11231123

1124+
if xml is None:
1125+
return []
1126+
11241127
# Get the objects from the xml at this level
11251128
if self.SUFFIX is None:
11261129
objects = [xml]
@@ -1266,12 +1269,12 @@ def _set_reference(self, reference_name, reference_type, reference_var, exclusiv
12661269
references = getattr(obj, reference_var)
12671270
if references is None:
12681271
continue
1269-
elif hasattr(self, "__iter__") and self in references:
1272+
elif hasattr(references, "__iter__") and self in references:
12701273
if reference_name is not None and str(getattr(obj, reference_type.NAME)) == reference_name:
12711274
continue
12721275
references.remove(self)
12731276
if update: obj.update(reference_var)
1274-
elif hasattr(self, "__iter__") and str(self) in references:
1277+
elif hasattr(references, "__iter__") and str(self) in references:
12751278
if reference_name is not None and str(getattr(obj, reference_type.NAME)) == reference_name:
12761279
continue
12771280
references.remove(str(self))
@@ -1290,7 +1293,6 @@ def _set_reference(self, reference_name, reference_type, reference_var, exclusiv
12901293
if update: obj.update(reference_var)
12911294
elif hasattr(var, "__iter__") and self not in var and str(self) not in var:
12921295
var.append(self)
1293-
setattr(obj, reference_var, var)
12941296
if update: obj.update(reference_var)
12951297
elif hasattr(var, "__iter__"):
12961298
# The reference already exists so do nothing
@@ -3537,8 +3539,14 @@ def synchronize_config(self):
35373539
line = response.find("./msg/line")
35383540
if line is None:
35393541
raise err.PanDeviceError("Unable to syncronize configuration, no response from firewall")
3540-
if line.text.startswith("successfully sync'd running configuration to HA peer"):
3542+
elif line.text.startswith("successfully sync'd running configuration to HA peer"):
3543+
# PAN-OS 7.0
35413544
return True
3545+
elif line.text.startswith("HA synchronization job has been queued on peer. "
3546+
"Please check job status on peer."):
3547+
# PAN-OS 7.1
3548+
# Wait until synchronization done
3549+
return self.watch_op("show high-availability state", "group/running-sync", "synchronized")
35423550
else:
35433551
raise err.PanDeviceError("Unable to syncronize configuration: %s" % line.text)
35443552
else:

pandevice/panorama.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,12 @@ def refresh_devices(self, devices=(), only_connected=False, expand_vsys=True, in
311311

312312
# Combine the config XML and operational command XML to get a complete picture
313313
# of the device groups
314-
for dg_entry in devicegroup_configxml:
315-
for fw_entry in dg_entry.find('devices'):
316-
fw_entry_op = devicegroup_opxml.find("entry/devices/entry[@name='%s']" % fw_entry.get("name"))
317-
if fw_entry_op is not None:
318-
pandevice.xml_combine(fw_entry, fw_entry_op)
314+
if devicegroup_configxml is not None:
315+
for dg_entry in devicegroup_configxml:
316+
for fw_entry in dg_entry.find('devices'):
317+
fw_entry_op = devicegroup_opxml.find("entry/devices/entry[@name='%s']" % fw_entry.get("name"))
318+
if fw_entry_op is not None:
319+
pandevice.xml_combine(fw_entry, fw_entry_op)
319320

320321
dg = DeviceGroup()
321322
dg.parent = self

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
setup(
2424
name='pandevice',
25-
version='0.4.0',
25+
version='0.4.1',
2626
description='Framework for interacting with Palo Alto Networks devices via API',
2727
long_description='The Palo Alto Networks Device Framework is a way to interact with Palo Alto Networks devices (including Next-generation Firewalls and Panorama) using the device API that is object oriented and conceptually similar to interaction with the device via the GUI or CLI.',
2828
author='Palo Alto Networks',

0 commit comments

Comments
 (0)