Skip to content

Commit c96173c

Browse files
committed
Merge branch 'release/0.6.5'
2 parents 81e2871 + b11c851 commit c96173c

File tree

10 files changed

+40
-18
lines changed

10 files changed

+40
-18
lines changed

HISTORY.rst

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

6+
0.6.5
7+
-----
8+
9+
Released: 2018-10-07
10+
11+
Status: Alpha
12+
13+
- Fixed: ICMP Unreachable param type in security rules
14+
- Fixed: Content upgrade error
15+
- Fixed: (Python3) The comparison of encrypted types
16+
- Various documentation fixes
17+
618
0.6.4
719
-----
820

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ The following examples assume the modules were imported as such::
8181

8282
Create a subinterface and commit::
8383

84-
fw = firewall.Firewall("10.0.0.1", username="admin", password="admin")
84+
fw = firewall.Firewall("10.0.0.1", api_username="admin", api_password="admin")
8585
eth = fw.add(network.EthernetInterface("ethernet1/1", mode="layer3"))
8686
subeth = eth.add(network.Layer3Subinterface("ethernet1/1.30", ip="4.4.4.4/24", tag=30))
8787
subeth.create()
8888
fw.commit()
8989

9090
Operational commands leverage the 'op' method of the device::
9191

92-
fw = firewall.Firewall("10.0.0.1", username="admin", password="admin")
93-
print fw.op("show system info", xml=True)
92+
fw = firewall.Firewall("10.0.0.1", api_username="admin", api_password="admin")
93+
print fw.op("show system info")
9494

9595
Some operational commands have methods to refresh the variables in an object::
9696

docs/usage.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ more information.
8383

8484
In each of these examples, assume a Firewall and Panorama object have been instantiated::
8585

86-
fw = firewall.Firewall('10.0.0.1', 'admin', 'mypassword')
87-
pano = panorama.Panorama('10.0.0.5', 'admin', 'mypassword')
86+
fw = firewall.Firewall("10.0.0.1", "admin", "mypassword")
87+
pano = panorama.Panorama("10.0.0.5", "admin", "mypassword")
8888

8989
Create an address object on a firewall::
9090

9191
webserver = objects.AddressObject("Apache-webserver", "5.5.5.5", description="Company web server")
92-
fw.add(webapache)
92+
fw.add(webserver)
9393
webserver.create()
9494

9595
In this example, add() makes the AddressObject a child of the Firewall. This does not make any change to

examples/dyn_address_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
3131
Tag the IP 3.3.3.3 with the tag 'linux' and 'apache'::
3232
33-
$ python dyn_address_group.py 10.0.0.1 admin password 3.3.3.3 linux,apache
33+
$ python dyn_address_group.py -r linux,apache 10.0.0.1 admin password 3.3.3.3
3434
3535
Remove the tag apache from the IP 3.3.3.3::
3636
37-
$ python dyn_address_group.py -u 10.0.0.1 admin password 3.3.3.3 linux
37+
$ python dyn_address_group.py -u linux 10.0.0.1 admin password 3.3.3.3
3838
3939
Clear all tags from all IP's::
4040

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.6.4'
26+
__version__ = '0.6.5'
2727

2828

2929
import logging

pandevice/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2642,8 +2642,9 @@ def _sha1_hash(string):
26422642
return string[5:33]
26432643
else:
26442644
# Sha1 hash the cleartext value
2645-
sha1 = hashlib.sha1(string)
2646-
return base64.b64encode(sha1.digest())
2645+
# Python3: encode for sha1, decode for XML serialization.
2646+
sha1 = hashlib.sha1(string.encode('utf-8'))
2647+
return base64.b64encode(sha1.digest()).decode('utf-8')
26472648

26482649
def parse_xml(self, xml, settings, possibilities):
26492650
"""Parse the XML to find this parameter's value.

pandevice/errors.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class PanDeviceError(PanXapiError):
3737
def __init__(self, *args, **kwargs):
3838
self.pan_device = kwargs.pop('pan_device', None)
3939
super(PanDeviceError, self).__init__(*args, **kwargs)
40+
self.message = '{0}'.format(self)
4041

4142
class PanDeviceXapiError(PanDeviceError):
4243
"""General error returned by an API call"""

pandevice/policies.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class SecurityRule(VersionedPanObject):
7575
fromzone (list): From zones
7676
tozone (list): To zones
7777
source (list): Source addresses
78+
source_user (list): Source users and groups
79+
hip_profiles (list): GlobalProtect host integrity profiles
7880
destination (list): Destination addresses
7981
application (list): Applications
8082
service (list): Destination services (ports) (Default:
@@ -160,7 +162,7 @@ def _setup(self):
160162
params.append(VersionedParamPath(
161163
'schedule', path='schedule'))
162164
params.append(VersionedParamPath(
163-
'icmp_unreachable', path='icmp-unreachable'))
165+
'icmp_unreachable', path='icmp-unreachable', vartype='yesno'))
164166
params.append(VersionedParamPath(
165167
'disable_server_response_inspection', vartype='yesno',
166168
path='option/disable-server-response-inspection'))

pandevice/updater.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,21 +297,27 @@ def check(self):
297297
self.pandevice.content_version = self._parse_current_version(response)
298298
self.versions = self._parse_version_list(response)
299299

300-
def download(self, version="latest", sync_to_peer=True, sync=False):
300+
def download(self, sync_to_peer=None, sync=False):
301301
if not self.versions:
302302
self.check()
303303
available_versions = map(PanOSVersion, self.versions.keys())
304304
latest_version = max(available_versions)
305305
if self.versions[str(latest_version)]['downloaded']:
306306
return
307-
self._logger.info("Device %s downloading content version: %s" % (self.pandevice.id, version))
308-
response = self._op('request content upgrade download latest sync-to-peer "%s"' %
309-
"yes" if sync_to_peer else "no")
307+
self._logger.info("Device %s downloading content version: %s" % (self.pandevice.id, latest_version))
308+
if sync_to_peer is None:
309+
sync_to_peer_text = ''
310+
elif sync_to_peer:
311+
sync_to_peer_text = ' "" sync-to-peer "yes"'
312+
else:
313+
sync_to_peer_text = ' "" sync-to-peer "no"'
314+
command = 'request content upgrade download latest{0}'.format(sync_to_peer_text)
315+
response = self._op(command)
310316
if sync:
311317
result = self.pandevice.syncjob(response)
312318
if not result['success']:
313319
raise err.PanDeviceError("Device %s attempt to download content version %s failed: %s" %
314-
(self.pandevice.id, version, result['messages']))
320+
(self.pandevice.id, latest_version, result['messages']))
315321
return result
316322
else:
317323
return True

setup.py

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

2424
setup(
2525
name='pandevice',
26-
version='0.6.4',
26+
version='0.6.5',
2727
description='Framework for interacting with Palo Alto Networks devices via API',
2828
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.',
2929
author='Palo Alto Networks',

0 commit comments

Comments
 (0)