Skip to content

Commit

Permalink
feat(Cluster):added return public key method
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Apr 2, 2024
1 parent a1bd460 commit 20f5395
Show file tree
Hide file tree
Showing 5 changed files with 477 additions and 1 deletion.
2 changes: 2 additions & 0 deletions portal_client.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,9 @@ service VirtualMachineService {

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

string get_keypair_public_key_by_name(1:string key_name)

void delete_keypair(1:string key_name)


/**
Expand Down
9 changes: 8 additions & 1 deletion simple_vm_client/VirtualMachineHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ def resize_volume(self, volume_id: str, size: int) -> None:
def get_gateway_ip(self) -> dict[str, str]:
return self.openstack_connector.get_gateway_ip()

def get_keypair_public_key_by_name(self, key_name: str):
return self.openstack_connector.get_keypair_public_key_by_name(
key_name=key_name
)

def delete_keypair(self, key_name: str):
return self.openstack_connector.delete_keypair(key_name=key_name)

def get_calculation_values(self) -> dict[str, str]:
val = self.openstack_connector.get_calculation_values()
return val
Expand Down Expand Up @@ -419,7 +427,6 @@ def create_and_deploy_playbook(
)
gateway_ip = self.openstack_connector.get_gateway_ip()["gateway_ip"]
if self.openstack_connector.netcat(host=gateway_ip, port=port):

cloud_site = self.openstack_connector.CLOUD_SITE
return self.forc_connector.create_and_deploy_playbook(
public_key=public_key,
Expand Down
22 changes: 22 additions & 0 deletions simple_vm_client/VirtualMachineService-remote
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == "--help":
)
print(" ClusterInfo get_cluster_info(string cluster_id)")
print(" get_cluster_status(string cluster_id)")
print(" string get_keypair_public_key_by_name(string key_name)")
print(" void delete_keypair(string key_name)")
print(" VM get_server(string openstack_id)")
print(" void stop_server(string openstack_id)")
print(
Expand Down Expand Up @@ -664,6 +666,26 @@ elif cmd == "get_cluster_status":
)
)

elif cmd == "get_keypair_public_key_by_name":
if len(args) != 1:
print("get_keypair_public_key_by_name requires 1 args")
sys.exit(1)
pp.pprint(
client.get_keypair_public_key_by_name(
args[0],
)
)

elif cmd == "delete_keypair":
if len(args) != 1:
print("delete_keypair requires 1 args")
sys.exit(1)
pp.pprint(
client.delete_keypair(
args[0],
)
)

elif cmd == "get_server":
if len(args) != 1:
print("get_server requires 1 args")
Expand Down
Loading

0 comments on commit 20f5395

Please sign in to comment.