TritonDataCenter / node-smartdc

Legacy Client SDK and CLI for Triton Data Center

Home Page:https://tritondatacenter.com/getting-started

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sdc-listmachines --acount not working w/o --credentials true

Licenser opened this issue · comments

When passing --acount the key ID is wrong. look at:

  • keyId="/--credentials/keys/id_rsa"
  • GET /--credentials/machines?name=--tag

if you applie --credentials true it works so either --account should implie --credentials or be discared if --credentials is false

schroedinger:Projects licenser$ sdc-listmachines --debug true --acount admin
2012-04-16 07:36:32Z DEBUG: No ssh-agent identities found
2012-04-16 07:36:32Z DEBUG: Using private key from: /Users/licenser/.ssh/id_rsa
2012-04-16 07:36:32Z TRACE: RestClient: constructed { _log: [Function],
  url: 
   { protocol: 'http:',
     slashes: true,
     host: '172.16.0.4',
     hostname: '172.16.0.4',
     href: 'http://172.16.0.4/',
     pathname: '/',
     path: '/' },
  proto: 
   { parsers: [Object],
     STATUS_CODES: [Object],
     IncomingMessage: [Object],
     OutgoingMessage: [Object],
     ServerResponse: [Object],
     Agent: [Object],
     globalAgent: [Object],
     ClientRequest: [Object],
     request: [Function],
     get: [Function],
     Server: [Object],
     createServer: [Function],
     _connectionListener: [Function: connectionListener],
     Client: [Object],
     createClient: [Function] },
  path: '',
  headers: { Accept: 'application/json', 'x-api-version': '~6.5' },
  retryOptions: { retries: 3, minTimeout: 500 },
  retryCallback: [Function: checkFor500],
  contentType: 'application/json',
  noContentMD5: undefined }
2012-04-16 07:36:32Z TRACE: RestClient: _processArguments => { options: 
   { contentType: 'application/json',
     headers: 
      { 'x-api-version': '~6.5',
        Accept: 'application/json',
        Authorization: 'Signature keyId="/--credentials/keys/id_rsa",algorithm="rsa-sha256" itw33gmarbaJWHz1Za2tbYw5mRfoUCWchBykkplQKbrb+X1tFW22yPUN9prxW/8EOBOriTubeN1MLfU7JEc0TAXvetxWQt5uiVIIiU4xmcVyLu9/7MZ/ql5liZSaZwly2EcwldBiicw4cb2iUSj/8aW6ZziEXfsB/xmiNTiF8olcPxyL6xXLX0SmLaK+WTiE7WNNgSBShrD6AMts4/M38+xl/QaIqYz4Qu+nzCUHn9U91OC/2yTxR3PMIk5HREMlXttlvy6AMhhbvExkKOrqss94L6AmJSBUl9ZZzO5cPUU1tCWAnN1R0befx82rtm0mGZ3S6lcN5CL5OEXm8U/pcQ==',
        Date: 'Mon, 16 Apr 2012 07:36:32 GMT' },
     method: 'GET',
     path: '/--credentials/machines?name=--tag',
     host: '172.16.0.4',
     port: '80',
     query: { name: '--tag' },
     expect: [ 200 ] },
  callback: [Function] }
2012-04-16 07:36:32Z TRACE: RestClient(86a1d25, attempt=1): issuing request { contentType: 'application/json',
  headers: 
   { 'x-api-version': '~6.5',
     Accept: 'application/json',
     Authorization: 'Signature keyId="/--credentials/keys/id_rsa",algorithm="rsa-sha256" itw33gmarbaJWHz1Za2tbYw5mRfoUCWchBykkplQKbrb+X1tFW22yPUN9prxW/8EOBOriTubeN1MLfU7JEc0TAXvetxWQt5uiVIIiU4xmcVyLu9/7MZ/ql5liZSaZwly2EcwldBiicw4cb2iUSj/8aW6ZziEXfsB/xmiNTiF8olcPxyL6xXLX0SmLaK+WTiE7WNNgSBShrD6AMts4/M38+xl/QaIqYz4Qu+nzCUHn9U91OC/2yTxR3PMIk5HREMlXttlvy6AMhhbvExkKOrqss94L6AmJSBUl9ZZzO5cPUU1tCWAnN1R0befx82rtm0mGZ3S6lcN5CL5OEXm8U/pcQ==',
     Date: 'Mon, 16 Apr 2012 07:36:32 GMT',
     'content-length': 0 },
  method: 'GET',
  path: '/--credentials/machines?name=--tag',
  host: '172.16.0.4',
  port: '80',
  query: { name: '--tag' },
  expect: [ 200 ] }
2012-04-16 07:36:33Z TRACE: RestClient(86a1d25): GET /--credentials/machines?name=--tag => code=401, headers={ 'content-type': 'application/json',
  connection: 'keep-alive',
  'transfer-encoding': 'chunked' }
2012-04-16 07:36:33Z TRACE: RestClient(86a1d25): GET /--credentials/machines?name=--tag => body={"error":"key not found"}
2012-04-16 07:36:33Z TRACE: RestClient: GET /--credentials/machines?name=--tag: issuing callback

Nice :)

Ok, I'll add this to the fix list in here with the other one you reported.

Okay some more debugging and it seems that the problem was caused by misspelling --account with --acount - I have no clue what caused this to give the error above

I tracked this to a nopt bug and filed a report: npm/nopt#14