Fix eos call to prompt() (#32985)

* Remove the check entirely

The response tells you to authorize anyway
This commit is contained in:
Nathaniel Case 2017-11-16 12:48:53 -05:00 committed by GitHub
parent 212d96f779
commit c1c0ad5d69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -125,12 +125,6 @@ class Cli:
command = self._module.jsonify(command) command = self._module.jsonify(command)
return exec_command(self._module, command) return exec_command(self._module, command)
def check_authorization(self):
for cmd in ['show clock', 'prompt()']:
rc, out, err = self.exec_command(cmd)
out = to_text(out, errors='surrogate_then_replace')
return out.endswith('#')
def get_config(self, flags=None): def get_config(self, flags=None):
"""Retrieves the current config from the device or cache """Retrieves the current config from the device or cache
""" """
@ -193,9 +187,6 @@ class Cli:
def configure(self, commands): def configure(self, commands):
"""Sends configuration commands to the remote device """Sends configuration commands to the remote device
""" """
if not self.check_authorization():
self._module.fail_json(msg='configuration operations require privilege escalation')
conn = get_connection(self) conn = get_connection(self)
rc, out, err = self.exec_command('configure') rc, out, err = self.exec_command('configure')
@ -212,9 +203,6 @@ class Cli:
def load_config(self, commands, commit=False, replace=False): def load_config(self, commands, commit=False, replace=False):
"""Loads the config commands onto the remote device """Loads the config commands onto the remote device
""" """
if not self.check_authorization():
self._module.fail_json(msg='configuration operations require privilege escalation')
use_session = os.getenv('ANSIBLE_EOS_USE_SESSIONS', True) use_session = os.getenv('ANSIBLE_EOS_USE_SESSIONS', True)
try: try:
use_session = int(use_session) use_session = int(use_session)