Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:sschapiro:openstack:upstream
euca2ools
321-fix-url-parsing.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 321-fix-url-parsing.patch of Package euca2ools
Author: Scott Moser <smoser@ubuntu.com> Last-Update: 2011-02-25 Upstream: r321 Description: cherry pick from 321 Bug: https://bugs.launchpad.net/bugs/719547 Note, that this patch has the euca-bundle-vol changes removed from it. our bundle-vol is like upstream already, so that hunk did not apply. ------------------------------------------------------------ revno: 321 committer: Mitch Garnaat <mgarnaat@eucalyptus.com> branch nick: euca2ools-main timestamp: Wed 2010-12-01 10:10:50 -0500 message: Incorporating fix from smoser to euca-bundle-vol. Also changing URL parsing in main euca2ools module to use urlparse rather than rolling our own. Fixes launchpad bug 405628. === modified file 'euca2ools/euca2ools/__init__.py' --- a/euca2ools/euca2ools/__init__.py +++ b/euca2ools/euca2ools/__init__.py @@ -46,6 +46,7 @@ import subprocess import platform import urllib +import urlparse import re import shutil from boto.ec2.regioninfo import RegionInfo @@ -495,8 +496,7 @@ ): self.ec2_user_access_key = None self.ec2_user_secret_key = None - self.ec2_url = None - self.s3_url = None + self.url = None self.config_file_path = None self.is_s3 = is_s3 if compat: @@ -536,7 +536,7 @@ except ValueError: self.ec2_user_secret_key = value elif name in ('-U', '--url'): - self.ec2_url = value + self.url = value elif name == '--debug': self.debug = True elif name == '--config': @@ -605,40 +605,39 @@ raise ConnectionFailed if not self.is_s3: - if not self.ec2_url: - self.ec2_url = self.environ['EC2_URL'] - if not self.ec2_url: - self.ec2_url = \ + if not self.url: + self.url = self.environ['EC2_URL'] + if not self.url: + self.url = \ 'http://localhost:8773/services/Eucalyptus' print 'EC2_URL not specified. Trying %s' \ - % self.ec2_url + % self.url else: - if not self.ec2_url: - self.ec2_url = self.environ['S3_URL'] - if not self.ec2_url: - self.ec2_url = \ + if not self.url: + self.url = self.environ['S3_URL'] + if not self.url: + self.url = \ 'http://localhost:8773/services/Walrus' print 'S3_URL not specified. Trying %s' \ - % self.ec2_url + % self.url self.port = None self.service_path = '/' - if self.ec2_url.find('https://') >= 0: - self.ec2_url = self.ec2_url.replace('https://', '') + + rslt = urlparse.urlparse(self.url) + if rslt.scheme == 'https': self.is_secure = True else: - self.ec2_url = self.ec2_url.replace('http://', '') self.is_secure = False - self.host = self.ec2_url - url_parts = self.ec2_url.split(':') - if len(url_parts) > 1: - self.host = url_parts[0] - path_parts = url_parts[1].split('/', 1) - if len(path_parts) > 1: - self.port = int(path_parts[0]) - self.service_path = self.service_path + path_parts[1] - else: - self.port = int(url_parts[1]) + + self.host = rslt.netloc + l = self.host.split(':') + if len(l) > 1: + self.host = l[0] + self.port = int(l[1]) + + if rslt.path: + self.service_path = rslt.path if not self.is_s3: return EC2Connection(
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor