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

http status codes not handled #15

Closed
Rixillo opened this issue Mar 24, 2017 · 3 comments
Closed

http status codes not handled #15

Rixillo opened this issue Mar 24, 2017 · 3 comments

Comments

@Rixillo
Copy link
Contributor

Rixillo commented Mar 24, 2017

"amtctrl status" crashes with stack dump when it receives an http status code of 401 - Unauthorized.

I find the error handler in client.py, line 97:

        if resp.status_code == 200:
...
        else:
            print("Status: %s" % resp.status_code)
            print(pp_xml(resp.content))
            return 1

but seems it is not catching

Traceback (most recent call last):
  File "/usr/bin/amtctrl", line 5, in <module>
    pkg_resources.run_script('amt==0.6.0', 'amtctrl')
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1455, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/lib/python2.7/site-packages/amt-0.6.0-py2.7.egg/EGG-INFO/scripts/amtctrl", line 114, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/amt-0.6.0-py2.7.egg/EGG-INFO/scripts/amtctrl", line 102, in main
    print(amt.wsman.friendly_power_state(client.power_status()))
  File "/usr/lib/python2.7/site-packages/amt-0.6.0-py2.7.egg/amt/client.py", line 145, in power_status
    "PowerState")
  File "/usr/lib/python2.7/site-packages/amt-0.6.0-py2.7.egg/amt/client.py", line 171, in _find_value
    doc = ElementTree.fromstring(content)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1300, in XML
    parser.feed(text)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1642, in feed
    self._raiseerror(v)
  File "/usr/lib64/python2.7/xml/etree/ElementTree.py", line 1506, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: syntax error: line 1, column 63
@sdague
Copy link
Owner

sdague commented Mar 24, 2017

I think this is fixed with 2f82054

@sdague
Copy link
Owner

sdague commented Mar 24, 2017

if not, reopen the issue.

@sdague sdague closed this as completed Mar 24, 2017
@Rixillo
Copy link
Contributor Author

Rixillo commented Mar 24, 2017

OK now. Thanks for fixing.

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