Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Provide uuid for the connection information in the output. Closes #81.
Browse files Browse the repository at this point in the history
  • Loading branch information
chambridge committed Jul 24, 2017
1 parent 8e9925e commit f5bcecd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/command_syntax_usage.rst
Expand Up @@ -76,6 +76,7 @@ this contains a large amount of information about the operating system, hardware

- ``connection.host`` - The host address of the connection
- ``connection.port`` - The port used for the connection
- ``connection.uuid`` - An identifier for the connection either from subscription manager or generated
- ``cpu.bogomips`` - measurement of CPU speed made by the Linux kernel
- ``cpu.count`` - number of processors
- ``cpu.cpu_family`` - cpu family
Expand Down
7 changes: 7 additions & 0 deletions library/run_cmds.py
Expand Up @@ -14,6 +14,7 @@
"""Commands to run on machines"""

import json
import uuid

import ast
# pylint:disable=no-name-in-module
Expand Down Expand Up @@ -157,6 +158,12 @@ def execute_commands(self):

info_dict['connection.host'] = self.host
info_dict['connection.port'] = self.port

if info_dict['subman.virt.uuid'] == 'error':
info_dict['connection.uuid'] = str(uuid.uuid4())
else:
info_dict['connection.uuid'] = info_dict['subman.virt.uuid']

return info_dict


Expand Down
7 changes: 6 additions & 1 deletion module_utils/subman_facts_command.py
Expand Up @@ -44,7 +44,8 @@ def __init__(self):
'subman.cpu.cpu(s)',
'subman.cpu.cpu_socket(s)',
'subman.virt.host_type',
'subman.virt.is_guest']
'subman.virt.is_guest',
'subman.virt.uuid']
self.cmd_names['subman_has_facts'] = ['subman.hash_facts_file']

self.fields = {'subman.cpu.core(s)_per_socket': _('cpu.core(s)_'
Expand All @@ -69,6 +70,10 @@ def __init__(self):
'(from '
'subscription-manager '
'facts --list)'),
'subman.virt.uuid': _('virt.uuid '
'(from '
'subscription-manager '
'facts --list)'),
'subman.has_facts_file': _('Whether '
'subscription-manager'
' has a facts file')}
Expand Down

0 comments on commit f5bcecd

Please sign in to comment.