cloudmesh / client

Deprecated: Version 3 of cloudmesh is a light weight cloud client to manage virtual clusters
http://cloudmesh.github.io/client
Other
3 stars 12 forks source link

cm cloud lists asks for password #226

Closed badmutex closed 8 years ago

badmutex commented 8 years ago

A fresh install of client (version info below) asks for a password before listing the cloud information. I can enter completely random password and it still "works"

$ cm cloud list
Password:
Password:
+----+---------------+---------+--------+------------+-----+
| id | Cloud         | Default | Active | Status     | Key |
+----+---------------+---------+--------+------------+-----+
| 0  | kilo          | *       | *      | Logged Out | TBD |
| 1  | chameleon     |         |        | Logged Out | TBD |
| 2  | jetstream     |         |        | Logged Out | TBD |
| 3  | cybera-c      |         |        | Logged Out | TBD |
| 4  | cybera-e      |         |        | Logged Out | TBD |
| 5  | aws           |         |        | Logged Out | TBD |
| 6  | chameleon-ec2 |         |        | Logged Out | TBD |
| 7  | azure         |         |        | Logged Out | TBD |
+----+---------------+---------+--------+------------+-----+

The workaround was to set the variables clouds/kilo/credentials to something other than TBD in ~/.cloudmesh/cloudmesh.yaml.

My understanding after speaking with Fugang is that cm should not be asking for a password here. At the very least, some information about what password is being asked for should be given.

$ cm version
+------------------+---------+
| name             | version |
+------------------+---------+
| python           | 2.7.11  |
| pip              | 8.1.2   |
| cloudmesh_client | 4.2.5   |
| git hash         | fabacab |
+------------------+---------+
You are running a supported version of python: 2.7.11
You are running a supported version of pip: 8.1.2
fugangwang commented 8 years ago

In this file: cloud/iaas/provider/openstack/CloudProviderOpenstackAPI.py The method definition in: initialize(self, cloudname, user=None) logon(self, cloudname)

We have such call of getpass(): os_password = credentials["OS_PASSWORD"] if os_password.lower() in ["readline", "read", "tbd"]: os_password = getpass.getpass()

Which seems invoked for the default cloud even without a direct invoke of the logon/activate.

Hagen Hodgkins reported similar issue when issuing a 'cm secgroup upload' call.

My suggestion is to eliminate such interactive feature from the code so it won't be invoked behind the scene by other calls.

laszewsk commented 8 years ago

i think the get pass in in principal good, but in this case its somehwo bypassed.

i think we need to check if TBD is set in profile and force a profile update in some fashion we als need to be able to set the profile non interactively so we can get it passed travis and other envs

what i do not understand is that it actually asks for a apssword as all should be taken care of.

so the get pass shoudl only be asked in OS_PASSWORD, but i verified that it is set in hagens case, lets meet tomorrow to look at this setup. this csrtainly needs to be fixed. I am not yest sure where te error is, but the getpass you found is probably the reason. there is something wrong in the logic

fugangwang commented 8 years ago

Resolved by 83351c4. As we wanted to keep the feature (not putting password to yaml, but ask for user input when needed), we kept the feature while adding more informative message. Also we improved the code so it will ask only once for each cloud as long as a session is maintained.