Skip to content

Commit 20f5395

Browse files
committed
feat(Cluster):added return public key method
1 parent a1bd460 commit 20f5395

File tree

5 files changed

+477
-1
lines changed

5 files changed

+477
-1
lines changed

portal_client.thrift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,9 @@ service VirtualMachineService {
587587

588588
map<string,string>get_cluster_status(1:string cluster_id) throws(1:ClusterNotFoundException c)
589589

590+
string get_keypair_public_key_by_name(1:string key_name)
590591

592+
void delete_keypair(1:string key_name)
591593

592594

593595
/**

simple_vm_client/VirtualMachineHandler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ def resize_volume(self, volume_id: str, size: int) -> None:
9999
def get_gateway_ip(self) -> dict[str, str]:
100100
return self.openstack_connector.get_gateway_ip()
101101

102+
def get_keypair_public_key_by_name(self, key_name: str):
103+
return self.openstack_connector.get_keypair_public_key_by_name(
104+
key_name=key_name
105+
)
106+
107+
def delete_keypair(self, key_name: str):
108+
return self.openstack_connector.delete_keypair(key_name=key_name)
109+
102110
def get_calculation_values(self) -> dict[str, str]:
103111
val = self.openstack_connector.get_calculation_values()
104112
return val
@@ -419,7 +427,6 @@ def create_and_deploy_playbook(
419427
)
420428
gateway_ip = self.openstack_connector.get_gateway_ip()["gateway_ip"]
421429
if self.openstack_connector.netcat(host=gateway_ip, port=port):
422-
423430
cloud_site = self.openstack_connector.CLOUD_SITE
424431
return self.forc_connector.create_and_deploy_playbook(
425432
public_key=public_key,

simple_vm_client/VirtualMachineService-remote

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == "--help":
9090
)
9191
print(" ClusterInfo get_cluster_info(string cluster_id)")
9292
print(" get_cluster_status(string cluster_id)")
93+
print(" string get_keypair_public_key_by_name(string key_name)")
94+
print(" void delete_keypair(string key_name)")
9395
print(" VM get_server(string openstack_id)")
9496
print(" void stop_server(string openstack_id)")
9597
print(
@@ -664,6 +666,26 @@ elif cmd == "get_cluster_status":
664666
)
665667
)
666668

669+
elif cmd == "get_keypair_public_key_by_name":
670+
if len(args) != 1:
671+
print("get_keypair_public_key_by_name requires 1 args")
672+
sys.exit(1)
673+
pp.pprint(
674+
client.get_keypair_public_key_by_name(
675+
args[0],
676+
)
677+
)
678+
679+
elif cmd == "delete_keypair":
680+
if len(args) != 1:
681+
print("delete_keypair requires 1 args")
682+
sys.exit(1)
683+
pp.pprint(
684+
client.delete_keypair(
685+
args[0],
686+
)
687+
)
688+
667689
elif cmd == "get_server":
668690
if len(args) != 1:
669691
print("get_server requires 1 args")

0 commit comments

Comments
 (0)