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

added method to detect hostname using hostnamectl #74

Merged
merged 1 commit into from Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -18,6 +18,8 @@ develop-eggs
lib
lib64
__pycache__
#Iso files downloaded by the patcher
*.iso

# Installer logs
pip-log.txt
Expand Down
15 changes: 15 additions & 0 deletions patcher.py
Expand Up @@ -902,6 +902,21 @@ def unmount_cd():
if debug == True:
print("Detected HOST UUID: " + HOSTUUID)

# Try finding host UUID by comparing to hostnamectl
if HOSTUUID == "" or HOSTUUID == ['']:
out = None
err = None
get_host_uuid_cmd = str(xecli) + str(' host-list name-label=`hostnamectl --static` params=uuid --minimal')
get_host_uuid = subprocess.Popen([get_host_uuid_cmd], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
if debug == True:
print("Getting host list using: " + get_host_uuid_cmd)
(out, err) = get_host_uuid.communicate()
if not err and out != None:
HOSTUUID_utf8 = out.decode("utf8")
HOSTUUID = str(HOSTUUID_utf8.replace('\n', ''))
if debug == True:
print("Detected HOST UUID: " + HOSTUUID)

# Trap if the HostUUID is still null
if HOSTUUID == "" or HOSTUUID == ['']:
print("Error: Failed to obtain HOSTUUID from XE CLI")
Expand Down