1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Adds various fixes for f5 modules (#40208)

* Adds stty expansion for cli commands
* minor fixes
* Make bigiq rest client work correctly
This commit is contained in:
Tim Rupp 2018-05-16 12:14:12 -07:00 committed by GitHub
parent 548282139f
commit 5e7878a6a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 7 deletions

View file

@ -62,7 +62,9 @@ class F5Client(F5BaseClient):
class F5RestClient(F5BaseClient): class F5RestClient(F5BaseClient):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(F5RestClient, self).__init__(*args, **kwargs) params = kwargs.get('module').params
module = kwargs.pop('module')
super(F5RestClient, self).__init__(module=module, **params)
self.provider = self.merge_provider_params() self.provider = self.merge_provider_params()
@property @property

View file

@ -434,7 +434,7 @@ class F5BaseClient(object):
elif os.environ.get('ANSIBLE_NET_USERNAME', None): elif os.environ.get('ANSIBLE_NET_USERNAME', None):
result['user'] = os.environ.get('ANSIBLE_NET_USERNAME', None) result['user'] = os.environ.get('ANSIBLE_NET_USERNAME', None)
else: else:
result['user'] = True result['user'] = None
if provider.get('password', None): if provider.get('password', None):
result['password'] = provider.get('password', None) result['password'] = provider.get('password', None)
@ -445,7 +445,7 @@ class F5BaseClient(object):
elif os.environ.get('ANSIBLE_NET_PASSWORD', None): elif os.environ.get('ANSIBLE_NET_PASSWORD', None):
result['password'] = os.environ.get('ANSIBLE_NET_PASSWORD', None) result['password'] = os.environ.get('ANSIBLE_NET_PASSWORD', None)
else: else:
result['password'] = True result['password'] = None
if result['validate_certs'] in BOOLEANS_TRUE: if result['validate_certs'] in BOOLEANS_TRUE:
result['validate_certs'] = True result['validate_certs'] = True

View file

@ -73,9 +73,11 @@ class ActionModule(_ActionModule):
socket_path = connection.run() socket_path = connection.run()
display.vvvv('socket_path: %s' % socket_path, pc.remote_addr) display.vvvv('socket_path: %s' % socket_path, pc.remote_addr)
if not socket_path: if not socket_path:
return {'failed': True, return {
'msg': 'Unable to open shell. Please see: ' + 'failed': True,
'https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell'} 'msg': 'Unable to open shell. Please see: '
'https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell'
}
task_vars['ansible_socket'] = socket_path task_vars['ansible_socket'] = socket_path
else: else:

View file

@ -74,7 +74,7 @@ class ActionModule(_ActionModule):
display.vvvv('socket_path: %s' % socket_path, pc.remote_addr) display.vvvv('socket_path: %s' % socket_path, pc.remote_addr)
if not socket_path: if not socket_path:
return {'failed': True, return {'failed': True,
'msg': 'unable to open shell. Please see: ' + 'msg': 'Unable to open shell. Please see: '
'https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell'} 'https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shell'}
task_vars['ansible_socket'] = socket_path task_vars['ansible_socket'] = socket_path

View file

@ -51,10 +51,12 @@ class TerminalModule(TerminalBase):
def on_open_shell(self): def on_open_shell(self):
try: try:
self._exec_cli_command(b'modify cli preference display-threshold 0 pager disabled') self._exec_cli_command(b'modify cli preference display-threshold 0 pager disabled')
self._exec_cli_command(b'run /util bash -c "stty cols 1000000" 2> /dev/null')
except AnsibleConnectionFailure as ex: except AnsibleConnectionFailure as ex:
output = str(ex) output = str(ex)
if 'modify: command not found' in output: if 'modify: command not found' in output:
try: try:
self._exec_cli_command(b'tmsh modify cli preference display-threshold 0 pager disabled') self._exec_cli_command(b'tmsh modify cli preference display-threshold 0 pager disabled')
self._exec_cli_command(b'stty cols 1000000 2> /dev/null')
except AnsibleConnectionFailure as ex: except AnsibleConnectionFailure as ex:
raise AnsibleConnectionFailure('unable to set terminal parameters') raise AnsibleConnectionFailure('unable to set terminal parameters')