Make backend.RenewCrypto more testable
authorHelga Velroyen <helgav@google.com>
Tue, 19 Jan 2016 14:19:02 +0000 (15:19 +0100)
committerHelga Velroyen <helgav@google.com>
Fri, 22 Jan 2016 09:39:11 +0000 (10:39 +0100)
commit9738a3f5f4f718a9f9e44e38896e79bc1e729a4a
treeec36907b2d39fa987a8dc58fb4d3539746d30259
parent08626d35c8c72747853c1cd19595b8b3fa040896
Make backend.RenewCrypto more testable

In order to improve the testability of backend.RenewCrypto,
this patch does two things:
* It uses the previously introduced SSH utility functions.
  Those are easier to consistently mock during unit tests
  and they consistenly abstract the lower layer of file
  operations on SSH keys.
* When calling the subfunctions to add and remove keys,
  some of the optional parameters were not propagated,
  which in tests will prevent the mocks from being
  propagated.

Besides that, it also renames ReadRemoteSshPubKeys to
ReadRemoteSshPubKey, because that actually only fetches one
key.

Signed-off-by: Helga Velroyen <helgav@google.com>
Reviewed-by: Klaus Aehlig <aehlig@google.com>
lib/backend.py
lib/client/gnt_cluster.py
lib/client/gnt_node.py
lib/ssh.py
test/py/ganeti.client.gnt_cluster_unittest.py