Incorrect handling of credentials
RafPe opened this issue · 5 comments
Currently the parser is having issues with proper matching section names.
What is happening
When running command and specifying section name it incorrectly takes first section that contains the string of argument passed
[root@2ba808bf97d5 cli-edgeworkers]# akamai edgeworkers --section abc lg
Error: Missing host in edgegrid section: nsabc
at getEdgeProp (/cli/.akamai-cli/src/cli-edgeworkers/bin/utils/edgerc-parser.js:67:15)
at parseSectionLinesToConfig (/cli/.akamai-cli/src/cli-edgeworkers/bin/utils/edgerc-parser.js:53:16)
at sectionToLines.forEach (/cli/.akamai-cli/src/cli-edgeworkers/bin/utils/edgerc-parser.js:42:17)
at Map.forEach (<anonymous>)
at Object.parseEdgeGridToSectionArray (/cli/.akamai-cli/src/cli-edgeworkers/bin/utils/edgerc-parser.js:41:20)
at getEdgeGridSection (/cli/.akamai-cli/src/cli-edgeworkers/bin/utils/env-utils.js:21:33)
at Object.getEdgeGrid (/cli/.akamai-cli/src/cli-edgeworkers/bin/utils/env-utils.js:31:13)
at sendEdgeRequest (/cli/.akamai-cli/src/cli-edgeworkers/bin/service/edgeworkers-svc.js:72:27)
at getJson (/cli/.akamai-cli/src/cli-edgeworkers/bin/service/edgeworkers-svc.js:123:12)
at Object.getAllEdgeWorkerIds (/cli/.akamai-cli/src/cli-edgeworkers/bin/service/edgeworkers-svc.js:151:12)
[root@2ba808bf97d5 cli-edgeworkers]#
What should have happen?
> 😊 .bin git:(master) ✗ ../../akamai-edgeworkers --debug lg --section abc
----------------------------------------------------------------------
--- User has the following Permission Group acccess for group: any ---
----------------------------------------------------------------------
groupId groupName capabilities
------- --------------------------- --------------------------------------------------------------
12345 ABC-C-XX4EX7 VIEW,VIEW_VERSION,EDIT,VIEW_ACTIVATION,CREATE_VERSION,ACTIVATE
126822 abcxyz VIEW,VIEW_VERSION,EDIT,VIEW_ACTIVATION,CREATE_VERSION,ACTIVATE
126823 frontend VIEW,VIEW_VERSION,EDIT,VIEW_ACTIVATION,CREATE_VERSION,ACTIVATE
Credential files
[section-abc]
# some other credentials
client_secret = xxxxx----redacted----xxxxx
host = xxxxx----redacted----xxxxx
access_token = xxxxx----redacted----xxxxx
client_token = xxxxx----redacted----xxxxx
[nsabc]
# details of credentials
hostname = xxxxx----redacted----xxxxx
key = xxxxx----redacted----xxxxx
keyname = xxxxx----redacted----xxxxx
cpcode = xxxxx----redacted----xxxxx
[abc]
# Credentials that I would like to be used
client_secret = xxxxx----redacted----xxxxx
host = xxxxx----redacted----xxxxx
access_token = xxxxx----redacted----xxxxx
client_token = xxxxx----redacted----xxxxx
So it seems that the parser does not really perform in this situation.
I'm going to fix this issue in the hotfix/0.1.1 release i'm working on now. Closed PR because it didn't yield in the exact same logic that existed previously.
Hi @RafPe - EWCLI v0.1.1 has been released today that I believe should resolve this issue. Can you please upgrade to this version and retest? Thanks!
@dctheobald will try to test early next week. Thx!
Hi @RafPe - wanted to follow up to see if EWCLI 0.1.1 fixed this issue? I believe it should, but didn't want to close this without your confirmation.
Closing as no response for a couple of months. Please re-open if need be, thanks!