Skip to content

Commit

Permalink
Merge pull request #86 from olehermanse/sudo
Browse files Browse the repository at this point in the history
CFE-4361: Fixed issue where policy server IP was not printed in info command
  • Loading branch information
larsewi authored Apr 9, 2024
2 parents 734973d + 5194b24 commit 652a5a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cf_remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ def get_info(host, *, users=None, connection=None):
data["policy_server"] = ssh_cmd(
connection, "cat /var/cfengine/policy_server.dat"
)
if user != "root" and not data["policy_server"]:
# If we are not SSHing as root and we failed to read
# the policy_server.dat file try again using sudo:
data["policy_server"] = ssh_sudo(
connection, "cat /var/cfengine/policy_server.dat"
)

agent = r"/var/cfengine/bin/cf-agent"
data["agent"] = agent
Expand Down

0 comments on commit 652a5a6

Please sign in to comment.