Merge ~chad.smith/pycloudlib:ec2/list-keys into pycloudlib:master

Proposed by Chad Smith
Status: Rejected
Rejected by: Chad Smith
Proposed branch: ~chad.smith/pycloudlib:ec2/list-keys
Merge into: pycloudlib:master
Diff against target: 29 lines (+7/-1)
2 files modified
pycloudlib/ec2/cloud.py (+6/-0)
requirements.txt (+1/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot (community) continuous-integration Needs Fixing
Paride Legovini Pending
pycloudlib-devs Pending
Review via email: mp+387333@code.launchpad.net

Commit message

Add ec2.list_keys operation to allow for checking if keys exist.

It allows us to look before we leap before calling either delete_key
or upload_key.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:92d0105a53e3a62793823978d861c5ab08b48d87
https://jenkins.ubuntu.com/server/job/pycloudlib-ci-test/32/
Executed test runs:
    None: https://jenkins.ubuntu.com/server/job/admin-lp-git-vote/2324/

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/pycloudlib-ci-test/32//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Chad Smith (chad.smith) wrote :

Unmerged commits

92d0105... by Chad Smith

ec2: add list_keys cloud operation

45b554f... by Chad Smith

paramiko bump version to 2.7.1

55cc033... by Chad Smith

update boto deps for IP support on vpc instances

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/pycloudlib/ec2/cloud.py b/pycloudlib/ec2/cloud.py
2index 8944923..d542348 100644
3--- a/pycloudlib/ec2/cloud.py
4+++ b/pycloudlib/ec2/cloud.py
5@@ -193,6 +193,12 @@ class EC2(BaseCloud):
6
7 return instance
8
9+ def list_keys(self):
10+ keypair_names = []
11+ for keypair in self.client.describe_key_pairs()["KeyPairs"]:
12+ keypair_names.append(keypair["KeyName"])
13+ return keypair_names
14+
15 def snapshot(self, instance, clean=True):
16 """Snapshot an instance and generate an image from it.
17
18diff --git a/requirements.txt b/requirements.txt
19index 6685110..ccbdd3a 100644
20--- a/requirements.txt
21+++ b/requirements.txt
22@@ -1,7 +1,7 @@
23 boto3==1.14.20
24 botocore==1.17.20
25 google-api-python-client==1.7.7
26-paramiko==2.6.0
27+paramiko==2.7.1
28 pyyaml==3.13
29 requests==2.22
30

Subscribers

People subscribed via source and target branches

to all changes: