Closed johnsonhays closed 7 years ago
I've verified that assigning a True
value to loginMsgAck
allows all operations to continue normally if the "Banner content must be acknowledged before loggin in" option is set to Yes
in the appliance.
Sample config file:
{
"ip": "172.16.101.241",
"image_streamer_ip": "172.16.102.60",
"api_version": 300,
"credentials": {
"userName": "administrator",
"authLoginDomain": "",
"password": "agreatsecret",
"loginMsgAck": true
}
This loginMsgAck
is not coded into the parser
shortcuts at the moment, so currently you'll have to specify your client config in your example file or in a sepparate config.json
file.
I'll add an option to accept that acknowledgement in the parser as soon as I'm able.
Another thing I've noticed, when I have the banner content enabled and I do not acknowledge the EULA, I receive the following error:
hpOneView.exceptions.HPOneViewException: ('Acknowledgment of login message is required. Message:This management appliance is a company owned asset and provided for the exclusive use of authorized personnel. Unauthorized use or abuse of this system may lead to corrective action including termination, civil and/or criminal penalties. .', {'details': 'Acknowledgment of the login message is required.', 'errorCode': 'AUTHN_LOGIN_MESSAGE_ACKNOWLEDGMENT_REQUIRED', 'nestedErrors': [], 'recommendedActions': ['Acknowledge login message by setting loginMsgAck attribute to true and try again.'], 'message': 'Acknowledgment of login message is required. Message:This management appliance is a company owned asset and provided for the exclusive use of authorized personnel. Unauthorized use or abuse of this system may lead to corrective action including termination, civil and/or criminal penalties. .', 'errorSource': None, 'data': {}})
Which is different from the failure with the header that you hit. That is perhaps an issue specific to the use of the parser options.
Could you share the contents of get-datacenters.py
so that I may try and reproduce that exact error?
Hi,
Thank you for your help! I updated the config.json with:
"loginMsgAck": true
I ran the datacenters.py file in the examples directory with a couple minor tweaks that do NOT involve the EULA. I am able to pull data now. I am fulling data from the OVA synergy appliance to simulate an actual oneview server. Again thank you!!
[root@ustlvcmsm0023 examples]# python3 datacenters_json.py Added Data Center MyDatacenter successfully
Get Data Center by URI: retrieved MyDatacenter successfully
Get Data Center device by name: MyDatacenter
Getting the Data Center visual content... [{'depth': 1000, 'healthStatus': 'OK', 'height': 2004, 'inferred': True, 'metric': 30.0, 'metricTimeStamp': '2017-07-13T04:55:00.000Z', 'name': '2AB100LMNB', 'resourceUri': '/rest/racks/2AB100LMNB', 'rotation': 0.0, 'uri': '/rest/racks/2AB100LMNB', 'width': 600, 'x': 600.0, 'y': 600.0}]
Successfully removed the data center
Johnson Hays
Hey @johnsonhays , thank you for the reply.
Since you're able to use the SDK in this case, I'm considering the issue as solved and closing it down.
Regards,
Hi,
Have been working with the SDK, and it works well, when you do not have a Login banner banner page. This is the page that all users see before they login. It is configigured under Settings -> security -> Actions -> Edit -> Login -> Message -> Require acknowledgment.
What would be the command to say ok and contiue to the normal login?
When this is not set, I am able to execute the scripts. I get the following error when I try to use the SDK when it is set:
[root@ustlvcmsm0023 scripts]# python3 get-datacenters.py -a dcs.mycompany.com -u apiuser -p XXXXXXX Login failed Traceback (most recent call last): File "get-datacenters.py", line 117, in
sys.exit(main())
File "get-datacenters.py", line 112, in main
get_datacenters(fac)
File "get-datacenters.py", line 66, in get_datacenters
dcs = fac.get_datacenters()
File "/opt/rh/rh-python34/root/usr/lib/python3.4/site-packages/hpOneView-3.1.0-py3.4.egg/hpOneView/facilities.py", line 54, in wrapper
return func(*args, **kwargs)
File "/opt/rh/rh-python34/root/usr/lib/python3.4/site-packages/hpOneView-3.1.0-py3.4.egg/hpOneView/facilities.py", line 65, in get_datacenters
body = self._con.get(uri['datacenters'])
File "/opt/rh/rh-python34/root/usr/lib/python3.4/site-packages/hpOneView-3.1.0-py3.4.egg/hpOneView/connection.py", line 327, in get
raise HPOneViewException(body)
hpOneView.exceptions.HPOneViewException: ("Authorization error: Missing 'auth' header.", {'nestedErrors': [], 'errorCode': 'AUTHORIZATION_MISSING_AUTH_HEADER', 'data': {}, 'errorSource': None, 'message': "Authorization error: Missing 'auth' header.", 'details': "Missing 'auth' header from the request.", 'recommendedActions': ["Please provide the missing 'auth' header value and try again."]})
[root@ustlvcmsm0023 scripts]#
When the login banner is disabled:
[root@ustlvcmsm0023 scripts]# python3 get-datacenters.py -a dcs.mycompany.com -u apiuser -p XXXXXX {'category': 'datacenters', 'count': 1, 'created': '2017-06-02T11:17:37.722Z', 'eTag': None, 'members': [{'category': 'datacenters', 'contents': [], 'coolingCapacity': None, 'coolingMultiplier': 1.5, 'costPerKilowattHour': None, 'created': '2017-04-24T14:01:05.746Z', 'currency': 'USD', 'defaultPowerLineVoltage': 220, 'depth': 3000, 'deratingPercentage': 20.0, 'deratingType': 'NaJp', 'eTag': '2017-04-24T14:01:05.750Z', 'id': '2f51ff69-7ca8-4e38-9aa1-10769999999', 'modified': '2017-04-24T14:01:05.750Z', 'name': 'Datacenter 1', 'remoteSupportUri': '/rest/support/datacenters/2f51ff69-7ca8-4e38-9aa1-109999999', 'state': 'Unmanaged', 'status': 'OK', 'uri': '/rest/datacenters/2f51ff69-7ca8-4e38-9aa1-107629999999', 'uuid': '2f51ff69-7ca8-4e38-9aa1-107623729999', 'width': 7200}], 'modified': '2017-06-02T11:17:37.722Z', 'nextPageUri': None, 'prevPageUri': None, 'start': 0, 'total': 1, 'type': 'ErmResourceCollection', 'uri': '/rest/datacenters?start=0&count=1000'}
Johnson Hays hays @ hpe.com