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

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

Merged
merged 1 commit into from Sep 14, 2018

Conversation

Projects
None yet
6 participants
@theotherjimmy
Contributor

theotherjimmy commented Sep 10, 2018

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
`mbed dm`: Accept api key and host on the command line
### 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

This comment has been minimized.

Contributor

theotherjimmy commented Sep 10, 2018

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

@cmonr

cmonr approved these changes Sep 12, 2018

@cmonr cmonr requested a review from yogpan01 Sep 12, 2018

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 12, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Sep 12, 2018

@cmonr

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 12, 2018

/morph test

@cmonr cmonr added needs: CI and removed needs: review labels Sep 12, 2018

@mbed-ci

This comment has been minimized.

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 12, 2018

Sync failure.

/morph test

@yogpan01

This comment has been minimized.

Contributor

yogpan01 commented Sep 14, 2018

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

@cmonr

This comment has been minimized.

Contributor

cmonr commented Sep 14, 2018

/morph test

@cmonr cmonr added the risk: G label Sep 14, 2018

@mbed-ci

This comment has been minimized.

@cmonr cmonr merged commit 77e0730 into ARMmbed:master Sep 14, 2018

14 checks passed

ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
jenkins-ci/cloud_client_smoke_test Test job: successful
Details
travis-ci/astyle Passed, 598 files
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Passed, runtime is 9050 cycles (-1269 cycles)
Details
travis-ci/gitattributestest Local gitattributestest testing has passed
Details
travis-ci/licence_check Local licence_check testing has passed
Details
travis-ci/littlefs Passed, code size is 8372B (+0.00%)
Details
travis-ci/tools-py2.7 Local tools-py2.7 testing has passed
Details

@0xc0170 0xc0170 removed the needs: CI label Sep 14, 2018

@ashok-rao

This comment has been minimized.

Contributor

ashok-rao commented Sep 17, 2018

@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 <Cruz.Monrreal@arm.com>
Date:   Sat Sep 15 19:58:19 2018 -0500
@yogpan01

This comment has been minimized.

Contributor

yogpan01 commented Sep 17, 2018

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

@cmonr

This comment has been minimized.

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