Skip to content

Commit

Permalink
implem
Browse files Browse the repository at this point in the history
  • Loading branch information
apurvaraghu authored Dec 21, 2023
1 parent b05634f commit 6d7b361
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ansible_collections/juniper/device/plugins/connection/pyez.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
env:
- name: ANSIBLE_PYEZ_CONSOLE
vars:
- name: ansible_pyez_console
- name: ansible_pyez_console
private_key_file:
description:
- The private SSH key or certificate file used to authenticate to the remote device
Expand Down Expand Up @@ -202,7 +202,7 @@
vars:
- name: ansible_pyez_ssh_config
- name: ssh_config
"""
import pickle

Expand Down Expand Up @@ -453,7 +453,7 @@ def get_config(self, filter_xml=None, options=None, model=None,
"""
resp = self.dev.rpc.get_config(filter_xml, options, model, namespace, remove_ns, **kwarg)
return etree.tostring(resp)

def get_rpc_resp(self,rpc, ignore_warning, format):
"""Execute rpc on the device and get response.
Expand All @@ -469,16 +469,16 @@ def get_rpc_resp(self,rpc, ignore_warning, format):
Fails:
- If the RPC produces an exception.
"""
# data comes in JSON format, needs to be converted
rpc_val = xmltodict.unparse(rpc)
# data comes in JSON format, needs to be converted
rpc_val = xmltodict.unparse(rpc)
rpc_val = rpc_val.encode('utf-8')
parser = etree.XMLParser(ns_clean=True, recover=True, encoding='utf-8')
rpc_etree = etree.fromstring(rpc_val, parser=parser)
resp = self.dev.rpc(rpc_etree, normalize=bool(format == 'xml'), ignore_warning=ignore_warning)
if(format == 'json'):
return resp
return etree.tostring(resp)

def get_facts(self):
"""Get device facts.
"""
Expand Down Expand Up @@ -769,7 +769,7 @@ def system_api(self, action, in_min, at, all_re, vmhost, other_re, media):
if action == 'reboot':
got = self.sw.reboot(in_min, at, all_re, None, vmhost, other_re)
elif action == 'shutdown':
got = self.sw.poweroff(in_min, at, None, all_re, other_re)
got = self.sw.poweroff(in_min, at, None, all_re, other_re, vmhost)
elif action == 'halt':
got = self.sw.halt(in_min, at, all_re, other_re)
elif action == 'zeroize':
Expand Down

0 comments on commit 6d7b361

Please sign in to comment.