Skip to content

mbed dm: Accept api key and host on the command line #8063

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

Merged
merged 1 commit into from
Sep 14, 2018

Conversation

theotherjimmy
Copy link
Contributor

Description

mbed dm will now accept the Pelion Device Management API Key and
Host on the command line with the following switches:

  • -a, --api-key accepts the API Key
  • -S (note capitol), --server-address accepts the Host

This is consistant with manifest tool parameters
Resolves ARMmbed/mbed-cli#745

Pull request type

[x] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

### Description

`mbed dm` will now accept the Pelion Device Management API Key and
Host on the command line with the following switches:
 * `-a`, `--api-key` accepts the API Key
 * `-S` (note capitol), `--server-address` accepts the Host

 This is consistant with manifest tool parameters
 Resolves ARMmbed/mbed-cli#745

### Pull request type

    [x] Fix
    [ ] Refactor
    [ ] Target update
    [ ] Functionality change
    [ ] Breaking change
@theotherjimmy
Copy link
Contributor Author

@dhwalters423 Is this what you requested in ARMmbed/mbed-cli#745?

@cmonr cmonr requested a review from yogpan01 September 12, 2018 02:19
@cmonr
Copy link
Contributor

cmonr commented Sep 12, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Sep 12, 2018

Build : FAILURE

Build number : 3050
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8063/

@cmonr
Copy link
Contributor

cmonr commented Sep 12, 2018

All build failures occurred on a single node. Am thinking that something went wrong when bringing it up.

/morph build

@mbed-ci
Copy link

mbed-ci commented Sep 12, 2018

Build : SUCCESS

Build number : 3052
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/8063/

Triggering tests

/morph test
/morph export-build
/morph mbed2-build

@mbed-ci
Copy link

mbed-ci commented Sep 12, 2018

@mbed-ci
Copy link

mbed-ci commented Sep 12, 2018

@cmonr
Copy link
Contributor

cmonr commented Sep 12, 2018

/morph test

@mbed-ci
Copy link

mbed-ci commented Sep 12, 2018

@cmonr
Copy link
Contributor

cmonr commented Sep 12, 2018

Sync failure.

/morph test

@yogpan01
Copy link
Contributor

@ARMmbed/mbed-os-maintainers This is blocking #8105 for OOB testing with Pelion DM.
Please get it merged for RC3 release.

@cmonr
Copy link
Contributor

cmonr commented Sep 14, 2018

/morph test

@cmonr cmonr added the risk: G label Sep 14, 2018
@mbed-ci
Copy link

mbed-ci commented Sep 14, 2018

@cmonr cmonr merged commit 77e0730 into ARMmbed:master Sep 14, 2018
@0xc0170 0xc0170 removed the needs: CI label Sep 14, 2018
@ashok-rao
Copy link
Contributor

@yogpan01 : This does Not fix the issue for me.. here is my latest log.. I'm using master of mbed OS and RC2 of PDMC ..also using the admin API key from OS2 (staging) ..

C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal>mbed dm init -d "arm.com" --model-name "ashok" --force -q
Traceback (most recent call last):
  File "C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal\mbed-os\tools\device_management.py", line 167, in <module>
    main()
  File "C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal\mbed-os\tools\device_management.py", line 162, in main
    }[options.action](options) or 0
  File "C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal\mbed-os\tools\device_management.py", line 99, in inner
    'key': api_key
  File "c:\python27\lib\site-packages\mbed_cloud\pagination.py", line 150, in next
    return self.__next__()
  File "c:\python27\lib\site-packages\mbed_cloud\pagination.py", line 155, in __next__
    self._get_next_page()
  File "c:\python27\lib\site-packages\mbed_cloud\pagination.py", line 96, in _get_next_page
    resp = self._func(**query)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\apis\developer_api.py", line 446, in get_all_api_keys
    (data) = self.get_all_api_keys_with_http_info(**kwargs)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\apis\developer_api.py", line 531, in get_all_api_keys_with_http_info
    collection_formats=collection_formats)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\api_client.py", line 353, in call_api
    _return_http_data_only, collection_formats, _preload_content, _request_timeout)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\api_client.py", line 113, in wrapped_f
    return fn(self, *args, **kwargs)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\api_client.py", line 182, in __call_api
    _request_timeout=_request_timeout)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\api_client.py", line 374, in request
    headers=headers)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\rest.py", line 235, in GET
    query_params=query_params)
  File "c:\python27\lib\site-packages\mbed_cloud\_backends\iam\rest.py", line 226, in request
    raise ApiException(http_resp=r)
mbed_cloud._backends.iam.rest.ApiException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Content-Length': '145', 'Access-Control-Expose-Headers': 'X-Request-ID,Content-Length,Content-Disposition', 'Set-Cookie': 'TS017f188d=011138c4dfd6fd59d8b7716ad7847ccec8818816f2aac491d942d4597f3c95e3a07fa6d68a92a2afc1ae196519fccf68fcaab84a69; Path=/', 'Strict-Transport-Security': 'max-age=10886400; includeSubDomains; preload', 'Vary': 'Origin', 'X-Request-ID': '00005b9f86f14eb641c93ce200000007', 'Connection': 'keep-alive', 'Date': 'Mon, 17 Sep 2018 10:50:26 GMT', 'Access-Control-Allow-Origin': 'https://portal.mbedcloud.com', 'Content-Type': 'application/json; charset=utf-8'})
HTTP response body: {"request_id":"00005b9f86f14eb641c93ce200000007","object":"error","message":"The provided API key is invalid","code":401,"type":"invalid_apikey"}

[mbed] ERROR: "c:\python27\python.exe" returned error.
       Code: 1
       Path: "C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal"
       Command: "c:\python27\python.exe -u C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal\mbed-os\tools\device_management.py init -d arm.com --model-name ashok --force -q"
       Tip: You could retry the last command with "-v" flag for verbose output
---

C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal>mbed ls
mbed-cloud-client-example-sources-internal (#83d3546427b8, tag: 2.0.0-RC2)
|- drivers\wifi-x-nucleo-idw01m1 (#a00282000178, tag: v1.2.0)
|- mbed-cloud-client (#b9587d8aa02d, tag: 2.0.0-RC2)
`- mbed-os (#0cd43157d18b)

C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal>cd mbed-os

C:\Ashok\mbed_CLI\OoB_5_10\PDM\mbed-cloud-client-example-sources-internal\mbed-os>git log
commit 0cd43157d18b4c7e6ab751e8a3c851cf136323b3 (HEAD -> master, origin/master, origin/HEAD)
Merge: aee6325ba cf12bef7d
Author: Cruz Monrreal <[email protected]>
Date:   Sat Sep 15 19:58:19 2018 -0500

@yogpan01
Copy link
Contributor

@theotherjimmy Please check @ashok-rao 's issue?

@cmonr
Copy link
Contributor

cmonr commented Sep 17, 2018

Conversation will be continued here: #8105

@ashok-rao has already commented: #8105 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants