kgranroth-tm commented on issue #115: URL: https://github.com/apache/cloudstack-cloudmonkey/issues/115#issuecomment-1513774062
Hi @nvazquez. Thanks for the attempted fix. Unfortunately, this does not address the root of the bug and instead just impacts one of the workarounds. The bug remains that `cmk` is not using the CLI `profile` arg to load the cache file and instead just uses the `profile =` line in the config file. Here are a series of tests using your patched version of `cmk`. **Test 1:** Empty profile config; existing dev profile cache; specify dev profile on CLI -- command is still not found since cache is not loaded ``` $ grep profile ~/.cmk/config profile = $ ls ~/.cmk/profiles dev.cache $ ./bin/cmk -d -p dev myCustomCommand [debug] Trying to load profile: dev [debug] cmdline args:./bin/cmk, -d, -p, dev, myCustomCommand [debug] ExecCmd args: myCustomCommand Error: unknown command or API requested ``` **Test 2:** Set config profile to dev; existing dev profile; it doesn't matter if profile is set in CLI at all since it works against the config for each ``` $ grep profile ~/.cmk/config profile = dev $ ./bin/cmk -d -p dev myCustomCommand [debug] Trying to load profile: dev [debug] cmdline args:./bin/cmk, -d, -p, dev, myCustomCommand [debug] ExecCmd args: myCustomCommand <myCustomCommand output> $ ./bin/cmk -d myCustomCommand [debug] cmdline args:./bin/cmk, -d, myCustomCommand [debug] ExecCmd args: myCustomCommand <myCustomCommand output> ``` **Test 3:** Empty profile config; existing dev profile cache; specify prod profile on CLI -- get new accurate error that the prod.cache does not exist ``` $ grep profile ~/.cmk/config profile = $ ./bin/cmk -d -p prod myCustomCommand Cannot find a cache file for the profile: prod ``` **Test 4:** Set profile config to dev; existing dev profile cache; specify prod profile on CLI -- still get new accurate error that the prod.cache does not exist since it still doesn't ``` $ grep profile ~/.cmk/config profile = dev $ ./bin/cmk -d -p prod myCustomCommand Cannot find a cache file for the profile: prod ``` **Test 5:** Specify prod profile on CLI; attempt sync of the cache -- first *regression* since the error checking happens before the command parsing and thus the command to sync the profile cache will never get there since the profile cache doesn't exist! Catch-22. ``` $ ./bin/cmk -d -p prod sync Cannot find a cache file for the profile: prod ``` **Test 6:** Set profile config to prod; attempt sync of the cache with no profile set in CLI - this works since cmk does honor whatever the config profile is set to and the new error code won't trigger with no CLI profile arg ``` $ grep profile ~/.cmk/config profile = prod $ ./bin/cmk sync Discovered 197 APIs $ ls ~/.cmk/profiles prod.cache ``` **Test 7:** Set profile config to prod; existing prod profile cache; specify prod profile on CLI -- this works and it does read the prod cache correctly ``` $ grep profile ~/.cmk/config profile = prod $ ./bin/cmk -d -p prod myCustomCommand [debug] Trying to load profile: prod [debug] cmdline args:./bin/cmk, -d, -p, prod, myCustomCommand [debug] ExecCmd args: myCustomCommand <myCustomCommand output> ``` **Test 8:** Empty profile config; existing prod profile cache; specify prod profile on CLI -- this still fails because cmk is not using the CLI arg to load the cache. There is no new error because the profile cache does exist (even though it is ignored). ``` $ grep profile ~/.cmk/config profile = $ ./bin/cmk -d -p prod myCustomCommand [debug] Trying to load profile: prod [debug] cmdline args:./bin/cmk, -d, -p, prod, myCustomCommand [debug] ExecCmd args: myCustomCommand Error: unknown command or API requested ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org