Merge pull request #3076 from mmoya/userspace-arch-facts
Provide userspace_{architecture,bits} facts
This commit is contained in:
commit
049b77be6d
1 changed files with 10 additions and 0 deletions
|
@ -144,10 +144,20 @@ class Facts(object):
|
||||||
self.facts['fqdn'] = socket.getfqdn()
|
self.facts['fqdn'] = socket.getfqdn()
|
||||||
self.facts['hostname'] = platform.node().split('.')[0]
|
self.facts['hostname'] = platform.node().split('.')[0]
|
||||||
self.facts['domain'] = '.'.join(self.facts['fqdn'].split('.')[1:])
|
self.facts['domain'] = '.'.join(self.facts['fqdn'].split('.')[1:])
|
||||||
|
arch_bits = platform.architecture()[0]
|
||||||
|
self.facts['userspace_bits'] = arch_bits.replace('bit', '')
|
||||||
if self.facts['machine'] == 'x86_64':
|
if self.facts['machine'] == 'x86_64':
|
||||||
self.facts['architecture'] = self.facts['machine']
|
self.facts['architecture'] = self.facts['machine']
|
||||||
|
if self.facts['userspace_bits'] == '64':
|
||||||
|
self.facts['userspace_architecture'] = 'x86_64'
|
||||||
|
elif self.facts['userspace_bits'] == '32':
|
||||||
|
self.facts['userspace_architecture'] = 'i386'
|
||||||
elif Facts._I386RE.search(self.facts['machine']):
|
elif Facts._I386RE.search(self.facts['machine']):
|
||||||
self.facts['architecture'] = 'i386'
|
self.facts['architecture'] = 'i386'
|
||||||
|
if self.facts['userspace_bits'] == '64':
|
||||||
|
self.facts['userspace_architecture'] = 'x86_64'
|
||||||
|
elif self.facts['userspace_bits'] == '32':
|
||||||
|
self.facts['userspace_architecture'] = 'i386'
|
||||||
else:
|
else:
|
||||||
self.facts['architecture'] = self.facts['machine']
|
self.facts['architecture'] = self.facts['machine']
|
||||||
if self.facts['system'] == 'Linux':
|
if self.facts['system'] == 'Linux':
|
||||||
|
|
Loading…
Reference in a new issue