Modified env fact gathering to use the native python method
Also updated CHANGELOG for this feature
This commit is contained in:
parent
d16a382935
commit
aadf8175c6
1 changed files with 3 additions and 13 deletions
12
system/setup
12
system/setup
|
@ -459,19 +459,9 @@ class Facts(object):
|
||||||
self.facts['user_id'] = getpass.getuser()
|
self.facts['user_id'] = getpass.getuser()
|
||||||
|
|
||||||
def get_env_facts(self):
|
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'] = {}
|
self.facts['env'] = {}
|
||||||
i = 0
|
for k,v in os.environ.iteritems():
|
||||||
for line in out.split('\n'):
|
|
||||||
if len(line) > 0:
|
|
||||||
try:
|
|
||||||
(k,v) = line.strip().split('=',1)
|
|
||||||
self.facts['env'][k] = v
|
self.facts['env'][k] = v
|
||||||
except ValueError, e:
|
|
||||||
self.facts['env']['ansible_error#%d' % i] = line
|
|
||||||
i = i + 1
|
|
||||||
|
|
||||||
class Hardware(Facts):
|
class Hardware(Facts):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue