Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Commit

Permalink
feat(SecurityGroups):added security groups"
Browse files Browse the repository at this point in the history
* feat(SecurityGroups):added method to create security groups

* feat(SecurityGroups):added logger

* feat(SecurityGroups):updated thrift file

* feat(SecurityGroups):added creation and deletion

* feat(SecurityGroups):added udp ports

* feat(Linting):fixed lint errors in handler
  • Loading branch information
dweinholz authored May 15, 2019
1 parent 1912165 commit 282b2e9
Show file tree
Hide file tree
Showing 9 changed files with 1,593 additions and 822 deletions.
711 changes: 439 additions & 272 deletions VirtualMachineService/VirtualMachineHandler.py

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions VirtualMachineService/VirtualMachineServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@

try:
from VirtualMachineService import Client, Processor
from VirtualMachineHandler import VirtualMachineHandler
except Exception as e:
except Exception:
from .VirtualMachineService import Client, Processor

try:
from VirtualMachineHandler import VirtualMachineHandler
except Exception:
from .VirtualMachineHandler import VirtualMachineHandler

from thrift.transport import TSSLSocket
Expand Down Expand Up @@ -60,8 +63,9 @@ def check_environment_variables(envs):
def check_env(var):
if var not in os.environ:
click.echo("ERROR: There is no {} set in environment.".format(var))
click.echo("Please make sure you have sourced your openstack rc file")
click.echo("Please make sure you have sourced your OpenStack rc file")
sys.exit()

list(map(lambda var: check_env(var), envs))


Expand Down
17 changes: 12 additions & 5 deletions VirtualMachineService/VirtualMachineService-remote
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.10.0)
# Autogenerated by Thrift Compiler (0.12.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
Expand All @@ -27,7 +27,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print(' bool check_Version(double version)')
print(' string get_client_version()')
print(' string import_keypair(string keyname, string public_key)')
print(' get_IP_PORT(string openstack_id)')
print(' get_ip_ports(string openstack_id)')
print(' get_Flavors()')
print(' get_Images()')
print(' Image get_Image_with_Tag(string openstack_id)')
Expand All @@ -37,6 +37,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print(' string add_floating_ip_to_server(string openstack_id, string network)')
print(' bool create_connection(string username, string password, string auth_url, string user_domain_name, string project_domain_name)')
print(' start_server(string flavor, string image, string public_key, string servername, string elixir_id, string diskspace, string volumename)')
print(' bool add_security_group_to_server(bool http, bool https, bool udp, string server_id)')
print(' VM get_server(string openstack_id)')
print(' bool stop_server(string openstack_id)')
print(' string create_snapshot(string openstack_id, string name, string elixir_id, string base_tag)')
Expand Down Expand Up @@ -147,11 +148,11 @@ elif cmd == 'import_keypair':
sys.exit(1)
pp.pprint(client.import_keypair(args[0], args[1],))

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

elif cmd == 'get_Flavors':
if len(args) != 0:
Expand Down Expand Up @@ -207,6 +208,12 @@ elif cmd == 'start_server':
sys.exit(1)
pp.pprint(client.start_server(args[0], args[1], args[2], args[3], args[4], args[5], args[6],))

elif cmd == 'add_security_group_to_server':
if len(args) != 4:
print('add_security_group_to_server requires 4 args')
sys.exit(1)
pp.pprint(client.add_security_group_to_server(eval(args[0]), eval(args[1]), eval(args[2]), args[3],))

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

0 comments on commit 282b2e9

Please sign in to comment.