From 11327a4802ba28b499fef1ed0be4695b05ffb546 Mon Sep 17 00:00:00 2001 From: Garfield Lee Freeman Date: Fri, 25 Mar 2022 11:39:14 -0700 Subject: [PATCH] feat(panos.panorama.Panorama): Add `refresh_shared_objects()` (#436) Fixes #428 --- panos/panorama.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/panos/panorama.py b/panos/panorama.py index cc446290..91209b77 100644 --- a/panos/panorama.py +++ b/panos/panorama.py @@ -883,6 +883,26 @@ def get_vm_auth_keys(self): return ans + def refresh_shared_objects(self, running_config=False, exceptions=True): + """Refresh all objects present in the shared scope. + + NOTE: This will remove any instance of any class that shows up + in the :class:`panos.panorama.Panorama` `CHILDTYPES` constant from + this Panorama's `children`. + + Args: + running_config (bool): Set to True to refresh from the running + configuration (Default: False) + exceptions (bool): Set to False to prevent exceptions on failure + (Default: True) + + """ + xml = self.xapi.get("/config/shared") + if xml is not None: + xml = xml.find("./result/shared") + + self.refresh(xml=xml, running_config=running_config, exceptions=exceptions) + class PanoramaCommit(object): """Normalization of a Panorama commit.