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

Change except Error when trying to get a missing option #39423

Merged
merged 1 commit into from Apr 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/fix_exception_type.yml
@@ -0,0 +1,2 @@
bugfixes:
- Capture correct exception type https://github.com/ansible/ansible/pull/39406
6 changes: 3 additions & 3 deletions lib/ansible/plugins/action/__init__.py
Expand Up @@ -236,11 +236,11 @@ def _make_tmp_path(self, remote_user=None):

try:
admin_users = self._connection._shell.get_option('admin_users') + [remote_user]
except KeyError:
except AnsibleError:
admin_users = ['root', remote_user] # plugin does not support admin_users
try:
remote_tmp = self._connection._shell.get_option('remote_tmp')
except KeyError:
except AnsibleError:
remote_tmp = '~/ansible'

# deal with tmpdir creation
Expand Down Expand Up @@ -405,7 +405,7 @@ def _fixup_perms2(self, remote_paths, remote_user=None, execute=True):

try:
admin_users = self._connection._shell.get_option('admin_users')
except KeyError:
except AnsibleError:
admin_users = ['root'] # plugin does not support admin users

if self._play_context.become and self._play_context.become_user and self._play_context.become_user not in admin_users + [remote_user]:
Expand Down
6 changes: 0 additions & 6 deletions lib/ansible/plugins/shell/powershell.py
Expand Up @@ -21,12 +21,6 @@
key: remote_tmp
vars:
- name: ansible_remote_tmp
admin_users:
description:
- List of users to be expected to have admin privileges, this is unused
in the PowerShell plugin
type: list
default: []
set_module_language:
description:
- Controls if we set the locale for moduels when executing on the
Expand Down