mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Modified env fact gathering to use the native python method
Also updated CHANGELOG for this feature
This commit is contained in:
parent
19343288df
commit
d1f713938e
2 changed files with 5 additions and 14 deletions
|
@ -18,7 +18,8 @@ New modules:
|
|||
|
||||
Misc changes:
|
||||
|
||||
* Added `state=touch` to the file module, which functions similarly to the command-line version of `touch`
|
||||
* Added `ansible_env` to the list of facts returned by the setup module.
|
||||
* Added `state=touch` to the file module, which functions similarly to the command-line version of `touch`.
|
||||
* Added a -vvvv level, which will show SSH client debugging information in the event of a failure.
|
||||
* Includes now support the more standard syntax, similar to that of role includes and dependencies. It is no longer necessary to specify a special "vas" field for the variables passed to the include.
|
||||
* Changed the `user:` parameter on plays to `remote_user:` to prevent confusion with the module of the same name. Still backwards compatible on play parameters.
|
||||
|
|
|
@ -459,19 +459,9 @@ class Facts(object):
|
|||
self.facts['user_id'] = getpass.getuser()
|
||||
|
||||
def get_env_facts(self):
|
||||
env_bin = module.get_bin_path('env')
|
||||
(rc, out, err) = module.run_command(env_bin)
|
||||
if rc == 0:
|
||||
self.facts['env'] = {}
|
||||
i = 0
|
||||
for line in out.split('\n'):
|
||||
if len(line) > 0:
|
||||
try:
|
||||
(k,v) = line.strip().split('=',1)
|
||||
self.facts['env'][k] = v
|
||||
except ValueError, e:
|
||||
self.facts['env']['ansible_error#%d' % i] = line
|
||||
i = i + 1
|
||||
self.facts['env'] = {}
|
||||
for k,v in os.environ.iteritems():
|
||||
self.facts['env'][k] = v
|
||||
|
||||
class Hardware(Facts):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue