Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define cache_entry and public_key outside the if statement #28

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

dmasteller4
Copy link

When defining a private key file, cache_entry is undefined, as well as public_key. This moves the two objects outside the if statement above, so they are always defined.

More verbose error output:

Unexpected failure during module execution.
The full traceback is:
Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.8/site-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
  File "/home/ec2-user/.local/lib/python3.8/site-packages/ansible/executor/task_executor.py", line 605, in _execute
    result = self._handler.run(task_vars=variables)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/ansible/plugins/action/gather_facts.py", line 100, in run
    res = self._execute_module(module_name=fact_module, module_args=mod_args, task_vars=task_vars, wrap_async=False)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/ansible/plugins/action/__init__.py", line 973, in _execute_module
    self._make_tmp_path()
  File "/home/ec2-user/.local/lib/python3.8/site-packages/ansible/plugins/action/__init__.py", line 390, in _make_tmp_path
    tmpdir = self._remote_expand_user(self.get_shell_option('remote_tmp', default='~/.ansible/tmp'), sudoable=False)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/ansible/plugins/action/__init__.py", line 856, in _remote_expand_user
    data = self._low_level_execute_command(cmd, sudoable=False)
  File "/home/ec2-user/.local/lib/python3.8/site-packages/ansible/plugins/action/__init__.py", line 1253, in _low_level_execute_command
    rc, stdout, stderr = self._connection.exec_command(cmd, in_data=in_data, sudoable=sudoable)
  File "/usr/share/ansible/plugins/connection/eci.py", line 465, in exec_command
    self.set_option('private_key_file', self._get_eci_data()[ECI_CACHE_KEY_FILE])
  File "/usr/share/ansible/plugins/connection/eci.py", line 548, in _get_eci_data
    if(ECI_CACHE_INSTANCE_ID in cache_entry):
UnboundLocalError: local variable 'cache_entry' referenced before assignment
fatal: [server01]: FAILED! => {}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant