| ... | ... |
@@ -116,7 +116,7 @@ class Config(object): |
| 116 | 116 |
if 'AWS_CREDENTIAL_FILE' in os.environ: |
| 117 | 117 |
self.env_config() |
| 118 | 118 |
if len(self.access_key)==0: |
| 119 |
- self.role_config() |
|
| 119 |
+ self.role_config() |
|
| 120 | 120 |
|
| 121 | 121 |
def role_config(self): |
| 122 | 122 |
conn = httplib.HTTPConnection(host='169.254.169.254',timeout=2) |
| ... | ... |
@@ -124,7 +124,7 @@ class Config(object): |
| 124 | 124 |
conn.request('GET', "/latest/meta-data/iam/security-credentials/")
|
| 125 | 125 |
resp = conn.getresponse() |
| 126 | 126 |
files = resp.read() |
| 127 |
- if resp.status == 200 and len(files)>1: |
|
| 127 |
+ if resp.status == 200 and len(files)>1: |
|
| 128 | 128 |
conn.request('GET', "/latest/meta-data/iam/security-credentials/%s"%files)
|
| 129 | 129 |
resp=conn.getresponse() |
| 130 | 130 |
if resp.status == 200: |
| ... | ... |
@@ -167,7 +167,7 @@ class Config(object): |
| 167 | 167 |
elif data["orig_key"]=="AWSSecretKey": |
| 168 | 168 |
data["key"] = "secret_key" |
| 169 | 169 |
else: |
| 170 |
- del data["key"] |
|
| 170 |
+ del data["key"] |
|
| 171 | 171 |
if "key" in data: |
| 172 | 172 |
Config().update_option(data["key"], data["value"]) |
| 173 | 173 |
if data["key"] in ("access_key", "secret_key", "gpg_passphrase"):
|
| ... | ... |
@@ -175,8 +175,6 @@ class Config(object): |
| 175 | 175 |
else: |
| 176 | 176 |
print_value = data["value"] |
| 177 | 177 |
debug("env_Config: %s->%s" % (data["key"], print_value))
|
| 178 |
- |
|
| 179 |
- |
|
| 180 | 178 |
|
| 181 | 179 |
def option_list(self): |
| 182 | 180 |
retval = [] |
| ... | ... |
@@ -159,7 +159,7 @@ def _get_filelist_from_file(cfg, local_path): |
| 159 | 159 |
except IOError, e: |
| 160 | 160 |
warning(u"--files-from input file %s could not be opened for reading (%s), skipping." % (fname, e.strerror)) |
| 161 | 161 |
continue |
| 162 |
- |
|
| 162 |
+ |
|
| 163 | 163 |
for line in f: |
| 164 | 164 |
line = line.strip() |
| 165 | 165 |
line = os.path.normpath(os.path.join(local_path, line)) |
| ... | ... |
@@ -636,7 +636,7 @@ def cmd_info(args): |
| 636 | 636 |
output(u" policy: %s" % policy) |
| 637 | 637 |
except: |
| 638 | 638 |
output(u" policy: none") |
| 639 |
- |
|
| 639 |
+ |
|
| 640 | 640 |
for grant in acl_grant_list: |
| 641 | 641 |
output(u" ACL: %s: %s" % (grant['grantee'], grant['permission'])) |
| 642 | 642 |
if acl.isAnonRead(): |
| ... | ... |
@@ -876,9 +876,7 @@ def cmd_sync_remote2local(args): |
| 876 | 876 |
os.umask(original_umask); |
| 877 | 877 |
mode = 0777 - original_umask; |
| 878 | 878 |
debug(u"mode=%s" % oct(mode)) |
| 879 |
- |
|
| 880 | 879 |
os.chmod(dst_file, mode); |
| 881 |
- |
|
| 882 | 880 |
debug(u"renamed chkptfname=%s to dst_file=%s" % (unicodise(chkptfname), unicodise(dst_file))) |
| 883 | 881 |
if response.has_key('s3cmd-attrs') and cfg.preserve_attrs:
|
| 884 | 882 |
attrs = response['s3cmd-attrs'] |
| ... | ... |
@@ -890,8 +888,8 @@ def cmd_sync_remote2local(args): |
| 890 | 890 |
os.utime(dst_file, (atime, mtime)) |
| 891 | 891 |
## FIXME: uid/gid / uname/gname handling comes here! TODO |
| 892 | 892 |
except OSError, e: |
| 893 |
- try: |
|
| 894 |
- dst_stream.close() |
|
| 893 |
+ try: |
|
| 894 |
+ dst_stream.close() |
|
| 895 | 895 |
os.remove(chkptfname) |
| 896 | 896 |
except: pass |
| 897 | 897 |
if e.errno == errno.EEXIST: |
| ... | ... |
@@ -905,14 +903,14 @@ def cmd_sync_remote2local(args): |
| 905 | 905 |
continue |
| 906 | 906 |
raise e |
| 907 | 907 |
except KeyboardInterrupt: |
| 908 |
- try: |
|
| 908 |
+ try: |
|
| 909 | 909 |
dst_stream.close() |
| 910 | 910 |
os.remove(chkptfname) |
| 911 | 911 |
except: pass |
| 912 | 912 |
warning(u"Exiting after keyboard interrupt") |
| 913 | 913 |
return |
| 914 | 914 |
except Exception, e: |
| 915 |
- try: |
|
| 915 |
+ try: |
|
| 916 | 916 |
dst_stream.close() |
| 917 | 917 |
os.remove(chkptfname) |
| 918 | 918 |
except: pass |
| ... | ... |
@@ -921,7 +919,7 @@ def cmd_sync_remote2local(args): |
| 921 | 921 |
# We have to keep repeating this call because |
| 922 | 922 |
# Python 2.4 doesn't support try/except/finally |
| 923 | 923 |
# construction :-( |
| 924 |
- try: |
|
| 924 |
+ try: |
|
| 925 | 925 |
dst_stream.close() |
| 926 | 926 |
os.remove(chkptfname) |
| 927 | 927 |
except: pass |