-
Notifications
You must be signed in to change notification settings - Fork 20
ent-13848: fix cf-remote info and install commands broken when run via vagrant shell provisioner #176
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
ent-13848: fix cf-remote info and install commands broken when run via vagrant shell provisioner #176
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
| data["os"] = "windows" | ||
| data["systeminfo"] = parse_systeminfo(systeminfo) | ||
| data["package_tags"] = ["x86_64", "msi"] | ||
|
|
@@ -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" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
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
systeminfoshould be None or empty, so the fix doesn't seem like the appropriate one.There was a problem hiding this comment.
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. :)