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

NameError: global name 'existing' is not defined with ansible 2.3 #22785

Closed
andreyhsiao opened this issue Mar 20, 2017 · 5 comments · Fixed by #22794
Closed

NameError: global name 'existing' is not defined with ansible 2.3 #22785

andreyhsiao opened this issue Mar 20, 2017 · 5 comments · Fixed by #22794
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. module This issue/PR relates to a module.

Comments

@andreyhsiao
Copy link

andreyhsiao commented Mar 20, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • file module
ANSIBLE VERSION
  • 2.3.0.0
OS / ENVIRONMENT
  • CentOS 7
SUMMARY
  1. building and installing the rpm package from stable-2.3 branch
  2. use the attributes parameter from the file module (which as documented was added in 2.3)
  3. met the error -> NameError: global name 'existing' is not defined

I checked the source code in lib/ansible/module_utils/basic.py, not sure where the var existing in ** line 1145: if existing.get('attr_flags','') != attributes: ** is defined

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 bug_report module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Mar 20, 2017
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Mar 20, 2017
@bcoca
Copy link
Member

bcoca commented Mar 20, 2017

mistakenly removed by 2374116
cc @dagwieers

@dagwieers
Copy link
Contributor

So this wasn't caught by integration testing !
I will fix this and add some tests as well.

bcoca added a commit to bcoca/ansible that referenced this issue Mar 20, 2017
@andreyhsiao
Copy link
Author

@bcoca Thanks, the attributes param seems working after adding "existing = self.get_file_attributes(b_path)".

will the fix be shipped with 2.3 release?

@dagwieers
Copy link
Contributor

@andreyhsiao Sorry for all the trouble. Yes, this must be part of v2.3 !

bcoca added a commit that referenced this issue Mar 20, 2017
fixes #22785

(cherry picked from commit 07d9366)
bcoca added a commit that referenced this issue Mar 20, 2017
dagwieers added a commit to dagwieers/ansible that referenced this issue Mar 21, 2017
This fixes ansible#22785

It also implements the following changes:
- Add integration tests adding/removing attributes
- Improve the error output when chown/chgrp fails
- Improve readability of other file-related errors
- Reformatted all tests to use YAML syntax
- Ensure error strings are using to_native()
@andreyhsiao
Copy link
Author

@dagwieers @bcoca Thanks all

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. module This issue/PR relates to a module.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants