diff options
| author | Eric Day <eday@oddments.org> | 2010-10-21 17:15:21 -0700 |
|---|---|---|
| committer | Eric Day <eday@oddments.org> | 2010-10-21 17:15:21 -0700 |
| commit | 8c6ef1380426aca6d7c82e3489789ccde8ee047c (patch) | |
| tree | 60c14d43bd489a63e5d733ad42bfcb8da4d81b16 /nova/cloudpipe | |
| parent | 7af25f1476f6a30cb45b4a1a990efecc9239169e (diff) | |
| download | nova-8c6ef1380426aca6d7c82e3489789ccde8ee047c.tar.gz nova-8c6ef1380426aca6d7c82e3489789ccde8ee047c.tar.xz nova-8c6ef1380426aca6d7c82e3489789ccde8ee047c.zip | |
PEP8 cleanup in nova/*, except for tests. There should be no functional changes here, just style changes to get violations down.
Diffstat (limited to 'nova/cloudpipe')
| -rw-r--r-- | nova/cloudpipe/pipelib.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 4fc2c85cb..3472201cd 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -49,7 +49,7 @@ class CloudPipe(object): self.manager = manager.AuthManager() def launch_vpn_instance(self, project_id): - logging.debug( "Launching VPN for %s" % (project_id)) + logging.debug("Launching VPN for %s" % (project_id)) project = self.manager.get_project(project_id) # Make a payload.zip tmpfolder = tempfile.mkdtemp() @@ -57,16 +57,18 @@ class CloudPipe(object): zippath = os.path.join(tmpfolder, filename) z = zipfile.ZipFile(zippath, "w", zipfile.ZIP_DEFLATED) - z.write(FLAGS.boot_script_template,'autorun.sh') + z.write(FLAGS.boot_script_template, 'autorun.sh') z.close() key_name = self.setup_key_pair(project.project_manager_id, project_id) zippy = open(zippath, "r") - context = context.RequestContext(user=project.project_manager, project=project) + context = context.RequestContext(user=project.project_manager, + project=project) reservation = self.controller.run_instances(context, - # run instances expects encoded userdata, it is decoded in the get_metadata_call - # autorun.sh also decodes the zip file, hence the double encoding + # Run instances expects encoded userdata, it is decoded in the + # get_metadata_call. autorun.sh also decodes the zip file, hence + # the double encoding. user_data=zippy.read().encode("base64").encode("base64"), max_count=1, min_count=1, @@ -79,12 +81,14 @@ class CloudPipe(object): def setup_key_pair(self, user_id, project_id): key_name = '%s%s' % (project_id, FLAGS.vpn_key_suffix) try: - private_key, fingerprint = self.manager.generate_key_pair(user_id, key_name) + private_key, fingerprint = self.manager.generate_key_pair(user_id, + key_name) try: key_dir = os.path.join(FLAGS.keys_path, user_id) if not os.path.exists(key_dir): os.makedirs(key_dir) - with open(os.path.join(key_dir, '%s.pem' % key_name),'w') as f: + file_name = os.path.join(key_dir, '%s.pem' % key_name) + with open(file_name, 'w') as f: f.write(private_key) except: pass @@ -95,9 +99,13 @@ class CloudPipe(object): # def setup_secgroups(self, username): # conn = self.euca.connection_for(username) # try: - # secgroup = conn.create_security_group("vpn-secgroup", "vpn-secgroup") - # secgroup.authorize(ip_protocol = "udp", from_port = "1194", to_port = "1194", cidr_ip = "0.0.0.0/0") - # secgroup.authorize(ip_protocol = "tcp", from_port = "80", to_port = "80", cidr_ip = "0.0.0.0/0") - # secgroup.authorize(ip_protocol = "tcp", from_port = "22", to_port = "22", cidr_ip = "0.0.0.0/0") + # secgroup = conn.create_security_group("vpn-secgroup", + # "vpn-secgroup") + # secgroup.authorize(ip_protocol = "udp", from_port = "1194", + # to_port = "1194", cidr_ip = "0.0.0.0/0") + # secgroup.authorize(ip_protocol = "tcp", from_port = "80", + # to_port = "80", cidr_ip = "0.0.0.0/0") + # secgroup.authorize(ip_protocol = "tcp", from_port = "22", + # to_port = "22", cidr_ip = "0.0.0.0/0") # except: # pass |
