Browse code

Cleanly handle AccessDenied errors from S3 during --configure

Matt Domsch authored on 2014/03/22 13:05:09
Showing 1 changed files
... ...
@@ -1785,13 +1785,18 @@ def run_configure(config_file, args):
1785 1785
                         else:
1786 1786
                             raise Exception("Encryption verification error.")
1787 1787
 
1788
-                except Exception, e:
1788
+                except S3Error, e:
1789 1789
                     error(u"Test failed: %s" % (e))
1790
-                    if e.find('403') != -1:
1790
+                    if e.code == "AccessDenied":
1791 1791
                         error(u"Are you sure your keys have ListAllMyBuckets permissions?")
1792 1792
                     val = raw_input("\nRetry configuration? [Y/n] ")
1793 1793
                     if val.lower().startswith("y") or val == "":
1794 1794
                         continue
1795
+                except Exception, e:
1796
+                    error(u"Test failed: %s" % (e))
1797
+                    val = raw_input("\nRetry configuration? [Y/n] ")
1798
+                    if val.lower().startswith("y") or val == "":
1799
+                        continue
1795 1800
 
1796 1801
 
1797 1802
             val = raw_input("\nSave settings? [y/N] ")