Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cf_remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def get_info(host, *, users=None, connection=None):
data["ssh_user"] = user

systeminfo = ssh_cmd(connection, "systeminfo")
if systeminfo:
if systeminfo and "command not found" not in systeminfo:
Comment on lines 218 to +219
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at this it looks like systeminfo should be None or empty, so the fix doesn't seem like the appropriate one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really is the right one. I am not 100% sure why yet.. but... when run from a vagrant shell provisioner the environment is subtly different so that systeminfo ends up being the stderr which includes "command not found" and retcode = 0.

I did notice that SHLVL=3 in the env inside the shell provisioner so not sure if some options are set that change things... I am happy to add a comment... or dig further and try to find the 100% root cause. :)

data["os"] = "windows"
data["systeminfo"] = parse_systeminfo(systeminfo)
data["package_tags"] = ["x86_64", "msi"]
Expand All @@ -225,6 +225,7 @@ def get_info(host, *, users=None, connection=None):
data["agent"] = agent
version_cmd = powershell("{} -V".format(agent))
data["agent_version"] = parse_version(ssh_cmd(connection, version_cmd))
data["role"] = "client"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking role should not always be set, but only if CFEngine is installed, or if it is bootstrapped perhaps.

Looking at ENT-13849 it seems like the issue is that we run sudo bash -c 'bash nt-discovery.sh' on windows or that we don't treat the failure of that correctly.

Seems like we need to either ensure we run the windows command first (systeminfo), and then don't do bash stuff if it's windows. Or we do bash first, and then fall back to windows code if that fails.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, the non-windows code path ALWAYS sets role, just depending on the presence of cf-hub. So I suppose that is not correct either. :) We can fix that also.

else:
data["os"] = "unix"

Expand Down
Loading