Skip to content

Commit

Permalink
Merge pull request ansible#5 from dgarros/pyez
Browse files Browse the repository at this point in the history
Add options to get_config to accept format (text, set or xml)
  • Loading branch information
privateip authored and Peter Sprygada committed Apr 24, 2016
1 parent 2c90472 commit 61baf41
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ansible/module_utils/junos.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,13 @@ def get_facts(self, refresh=True):
self.device.facts_refresh()
return self.device.facts

def get_config(self):
ele = self.rpc('get_configuration', format='text')
return str(ele.text).strip()
def get_config(self, config_format="text"):
ele = self.rpc('get_configuration', format=config_format)

if config_format == "text" or config_format == "set":
return str(ele.text).strip()
elif config_format == "xml":
return ele

def rpc(self, name, format='xml', **kwargs):
meth = getattr(self.device.rpc, name)
Expand Down Expand Up @@ -337,4 +341,3 @@ def get_module(**kwargs):

module.connect()
return module

0 comments on commit 61baf41

Please sign in to comment.