Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add admins parameter to Panorama push #485

Merged
merged 2 commits into from
Jan 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions panos/panorama.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,7 @@ class PanoramaCommitAll(object):
name (str): The name of the location to push the config to (e.g. - name
of the device group, name of the template, etc).
description (str): The commit message.
admins (list): (PAN-OS 10.2+) List of admins whose changes are to be pushed.
include_template (bool): (For `device group` style commits) Set to True to include
template changes.
force_template_values (bool): (For `device group`, `template`, or `template stack`
Expand All @@ -1077,6 +1078,7 @@ def __init__(
style,
name,
description=None,
admins=None,
include_template=None,
force_template_values=None,
devices=None,
Expand All @@ -1092,10 +1094,13 @@ def __init__(
raise ValueError("Invalid style {0}".format(style))
if devices and not isinstance(devices, list):
raise ValueError("devices must be a list")
if admins and not isinstance(admins, list):
raise ValueError("admins must be a list")

self.style = style
self.name = name
self.description = description
self.admins = admins
self.include_template = include_template
self.force_template_values = force_template_values
self.devices = devices
Expand Down Expand Up @@ -1126,6 +1131,10 @@ def element(self):
ET.SubElement(de, "entry", {"name": x})
if self.description:
ET.SubElement(body, "description").text = self.description
if self.admins:
adms = ET.SubElement(body, "admin")
for user in self.admins:
ET.SubElement(adms, "member").text = user
if self.include_template:
ET.SubElement(body, "include-template").text = "yes"
elif self.include_template is False:
Expand All @@ -1139,6 +1148,10 @@ def element(self):
ET.SubElement(body, "name").text = self.name
if self.description:
ET.SubElement(body, "description").text = self.description
if self.admins:
adms = ET.SubElement(body, "admin")
for user in self.admins:
ET.SubElement(adms, "member").text = user
if self.force_template_values:
ET.SubElement(body, "force-template-values").text = "yes"
elif self.force_template_values is False:
Expand All @@ -1152,6 +1165,10 @@ def element(self):
ET.SubElement(body, "name").text = self.name
if self.description:
ET.SubElement(body, "description").text = self.description
if self.admins:
adms = ET.SubElement(body, "admin")
for user in self.admins:
ET.SubElement(adms, "member").text = user
if self.force_template_values:
ET.SubElement(body, "force-template-values").text = "yes"
elif self.force_template_values is False:
Expand Down