Skip to content
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

plugin_version decorator doesn't work properly on Python 3.6 #329

Closed
xen0l opened this issue Mar 20, 2020 · 4 comments
Closed

plugin_version decorator doesn't work properly on Python 3.6 #329

xen0l opened this issue Mar 20, 2020 · 4 comments

Comments

@xen0l
Copy link
Owner

xen0l commented Mar 20, 2020

A user reported a problem that aws_gate is failing with capture_output=True in plugin_version on Python 3.6. That's possible because capture_output=True was added in Python 3.7.

We should fix this and come up with a better test.

2020-03-20 10:46:33,106 - aws_gate.cli                 - DEBUG - Using AWS profile "saml2aws" in region "eu-west-1"
2020-03-20 10:46:33,106 - aws_gate.utils               - DEBUG - Deferring signal: SIGHUP
2020-03-20 10:46:33,106 - aws_gate.utils               - DEBUG - Deferring signal: SIGINT
2020-03-20 10:46:33,106 - aws_gate.utils               - DEBUG - Deferring signal: SIGTERM
2020-03-20 10:46:33,107 - aws_gate.utils               - DEBUG - Executing "session-manager-plugin --version"
2020-03-20 10:46:33,107 - aws_gate.utils               - DEBUG - Restoring signal: SIGHUP
2020-03-20 10:46:33,107 - aws_gate.utils               - DEBUG - Restoring signal: SIGINT
2020-03-20 10:46:33,107 - aws_gate.utils               - DEBUG - Restoring signal: SIGTERM
Traceback (most recent call last):
  File "/home/david/.local/bin/aws-gate", line 11, in <module>
    main()
  File "/home/david/.local/bin/aws-gate", line 7, in main
    aws_gate.cli.main()
  File "/home/david/.local/lib/python3.6/site-packages/aws_gate/cli.py", line 262, in main
    key_size=args.key_size,
  File "/home/david/.local/lib/python3.6/site-packages/aws_gate/decorators.py", line 30, in plugin_required
    return wrapped_function(*args, **kwargs)
  File "/home/david/.local/lib/python3.6/site-packages/aws_gate/decorators.py", line 38, in wrapper
    version = execute_plugin(["--version"], capture_output=True)
  File "/home/david/.local/lib/python3.6/site-packages/aws_gate/utils.py", line 143, in execute_plugin
    return execute(PLUGIN_NAME, args, **kwargs)
  File "/home/david/.local/lib/python3.6/site-packages/aws_gate/utils.py", line 125, in execute
    result = subprocess.run([cmd] + args, env={"PATH": env}, check=True, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'
@larryon
Copy link

larryon commented Apr 10, 2020

I can confirm I have the same issue on python 3.6

@xen0l
Copy link
Owner Author

xen0l commented Apr 17, 2020

@larryon I created a fix for this, but I don't have Python 3.6 at my disposal right now. I will have more time to check it on during the weekend. If you need this to be merged sooner, by any chance you check if this works fine in your setup?

@larryon
Copy link

larryon commented Apr 21, 2020

Works fine, THanks @xen0l

@xen0l
Copy link
Owner Author

xen0l commented Apr 21, 2020

Merged in #352

@xen0l xen0l closed this as completed Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants