linode / cli

This is the DEPRECATED Linode CLI. Use https://github.com/linode/linode-cli
https://www.linode.com/docs/platform/linode-cli
Other
466 stars 36 forks source link

Do not try to create .linodecli dir if not necessary #27

Closed liayn closed 9 years ago

liayn commented 9 years ago

We're using the linode domain cli tools in web-scripts. The scripts are run as a user with very limited permissions. The user is NOT allowed to create the .linodecli directory in the home directory.

Since the API key is specified via command line arguments, the directory is not necessary at all. If we remove the mkdir() command from Util.pm::check_configs(), the scripts work without problems.

Would it be possible to add a check that skips the creation of this directory when not needed?

Thanks.

jamesottinger commented 9 years ago

We hadn't considered that use case. I agree that it shouldn't be a fatal event if this situation is encountered. Thanks for opening the issue!

liayn commented 9 years ago

Good to hear from you. I would really appreciate such a patch.

Generally all software should follow the principle: Only allocate resources that are really needed. That goes for all options and tools, not only for the usecase I mentioned.

In this case the solution would be best, if you would create the directory only when actually writing a file in that directory. If I read the code correctly you're currently trying to create the directory if it does not exist regardless of the type of operation. IMHO there's no need to create the directory for read-operations. If the config-file is not there it will still be missing even though you created the directory for it. ;-)

jamesottinger commented 9 years ago

liayn, thank you again for reporting this issue. The latest release addresses this and doesn't require a .linodecli dir or config.

liayn commented 9 years ago

@jamesottinger Awesome! Waiting for the update to hit the repository.