Skip to content

Commit

Permalink
Added user_error
Browse files Browse the repository at this point in the history
  • Loading branch information
victormlg committed Jan 13, 2025
1 parent cd4d932 commit c40dba6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cf_remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,19 @@ def get_info(host, *, users=None, connection=None):
scp("nt-discovery.sh", host, connection)
discovery = parse_envfile(ssh_sudo(connection, "bash nt-discovery.sh"))

data["uname"] = discovery.get("NTD_UNAME")
data["arch"] = discovery.get("NTD_ARCH")
data["os_release"] = os_release(discovery.get("NTD_OS_RELEASE"))
data["uname"] = discovery.get("NTD_UNAME") if discovery.get("NTD_UNAME") else user_error(discovery["NTD_UNAME_ERROR"])
data["arch"] = discovery.get("NTD_ARCH") if discovery.get("NTD_ARCH") else user_error(discovery["NTD_ARCH_ERROR"])
data["os_release"] = os_release(discovery.get("NTD_OS_RELEASE")) if discovery.get("NTD_OS_RELEASE") else user_error(discovery["NTD_OS_RELEASE_ERROR"])

os_release_data = data.get("os_release")
redhat_release_data = None
if not os_release_data:
redhat_release_data = discovery.get("NTD_REDHAT_RELEASE")
redhat_release_data = discovery.get("NTD_REDHAT_RELEASE") if discovery.get("NTD_REDHAT_RELEASE") else user_error(discovery["NTD_REDHAT_RELEASE_ERROR"])
data["redhat_release"] = redhat_release_data

data["package_tags"] = get_package_tags(os_release_data, redhat_release_data)
data["agent_location"] = discovery.get("NTD_CFAGENT_PATH")
data["policy_server"] = discovery.get("NTD_POLICY_SERVER")
data["policy_server"] = discovery.get("NTD_POLICY_SERVER")
agent = r"/var/cfengine/bin/cf-agent"
data["agent"] = agent
data["agent_version"] = parse_version(discovery.get("NTD_CFAGENT_VERSION"))
Expand Down

0 comments on commit c40dba6

Please sign in to comment.