openvstorage / framework

The Framework is a set of components and tools which brings the user an interface (GUI / API) to setup, extend and manage an Open vStorage platform.
Other
27 stars 23 forks source link

Missing ssh files are reported incorrectly #802

Closed JeffreyDevloo closed 8 years ago

JeffreyDevloo commented 8 years ago

Problem description

Received the following message when only /opt/OpenvStorage/.ssh/ files were missing.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++  An unexpected error occurred:                                                 +++
+++  Missing files:                                                                +++
+++  - Could not find file /opt/OpenvStorage/.ssh/id_rsa.pub on node with IP       +++
+++  10.100.199.151                                                                +++
+++  - Could not find file /opt/OpenvStorage/.ssh/known_hosts on node with IP      +++
+++  10.100.199.151                                                                +++
+++   - Could not find file /root/.ssh/id_rsa.pub on node with IP 10.100.199.151   +++
+++   - Could not find file /root/.ssh/known_hosts on node with IP 10.100.199.151  +++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Possible root of the problem

The check is only happening on one file instead of the file in the loop. Framework.ovs.lib.setup.py

for required_file in [known_hosts_ovs, known_hosts_root, ssh_public_key_ovs, ssh_public_key_root]:
 if not local_client.file_exists(ssh_public_key_ovs):
  missing_files.add('Could not find file {0} on node with IP {1}'.format(required_file, local_client.ip))
 if missing_files:
  raise ValueError('Missing files:\n - {0}'.format('\n - '.join(sorted(list(missing_files)))))

Possible solution

Change the if condition:

 if not local_client.file_exists(required_file):
khenderick commented 8 years ago

To be added here: the actual cause of the message was that the ovs user was created with a wrong home directory, that caused the package installation scripts to not created the key pairs in the expected location.

However, this problem will cause that the setup doesn't validate other files (e.g. root's keypair).

wimpers commented 8 years ago

@khenderick how can it be that the ovs user was created with the wrong home directory. Is it a bug in the code or should we tackle this with documentation?

wimpers commented 8 years ago

nevermind, the ovs user was created before (waffle didn't show the referenced issue).

khenderick commented 8 years ago

@wimpers, In this case @JeffreyDevloo just installed a fresh Ubuntu and when the Ubuntu setup asks for a non-privileged user, Jeffrey just entered "ovs" as it's username. The Ubuntu installation then creates a user with that username which will gets it home directory created under /home/ovs.

I remember that back in the days the documentation mentioned this since back then the Ubuntu installation itself was also documented.

khenderick commented 8 years ago

@wimpers, there's still an issue in the code reported here that must be fixed.

wimpers commented 8 years ago

Set to won't fix as if the ovs user isn't previously created, you don't run into the issue.

wimpers commented 8 years ago

Not having an ovs user before starting the install will be covered by documentation.

wimpers commented 8 years ago

Re-opening as fixed so put into state verification for QA.

dejonghb commented 8 years ago

If there's already an (unexpected) ovs user on the system (with an "incorrect home directory" -- whatever that may be); shouldn't the setup warn about it?

kinvaris commented 8 years ago

@dejonghb makes a very good point, @wimpers.

khenderick commented 8 years ago

@dejonghb, @kinvaris, it basically does this already by complaining the expected files could not be found. But maybe the message could be enhanced a bit more.

JeffreyDevloo commented 8 years ago

Reproduction of the issue gave me the expected output this time:

Steps

Output

Exchanging SSH keys and updating hosts files

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++  An unexpected error occurred:                                             +++
+++  Missing files:                                                            +++
+++  - Could not find file /opt/OpenvStorage/.ssh/id_rsa.pub on node with IP   +++
+++  10.100.199.153                                                            +++
+++  - Could not find file /opt/OpenvStorage/.ssh/known_hosts on node with IP  +++
+++  10.100.199.153                                                            +++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Test result

Test passed. The missing files are now reported correctly. Closing

Package information