-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Improvements to facilitate the documentation instructions #2036
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
Conversation
- Add hostname and account arguments to the argument parser. - Modify main to accommodate the new arguments. These changes allow users to run this example outside of a Compute Engine environment if they want.
args = parser.parse_args() | ||
|
||
main(args.cmd, args.project, args.instance, args.zone) | ||
main(args.cmd, args.project, args.instance, args.zone, |
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.
Should this be instance=args.instance, zone=args.zone here?
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.
Good catch this could fail in some situations. Thanks!
cmd, project, instance, zone, oslogin=None, account=None, hostname=None | ||
): | ||
def main(cmd, project, instance=None, zone=None, | ||
oslogin=None, account=None, hostname=None): |
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.
oslogin is not provided by the call from the body below.
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 shouldn't be necessary unless your application is initializing the API manually. service_account_ssh_test.py does this because it cannot manage SSH keys on the behalf of another service account, so it has to obtain the API key for the service account and initialize the API manually. If you don't provide an oslogin object, main() will generate one for you using whatever application default credentials it can obtain from the instance or environment variables.
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.
LGTM
These changes allow users to run this example outside of a Compute Engine environment if they want.