Permalink
Browse files

2007-09-03 Michal Ludvig <michal@logix.cz>

	* s3cmd: Small tweaks to --configure workflow.



git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@146 830e0280-6d2a-0410-9c65-932aecc39d9d
  • Loading branch information...
1 parent 0d91ff3 commit aa1c976f28b874f14f2b8ef61e66aeb0184369fc @mludvig mludvig committed Sep 3, 2007
Showing with 30 additions and 22 deletions.
  1. +4 −0 ChangeLog
  2. +2 −1 S3/S3.py
  3. +24 −21 s3cmd
View
@@ -1,3 +1,7 @@
+2007-09-03 Michal Ludvig <michal@logix.cz>
+
+ * s3cmd: Small tweaks to --configure workflow.
+
2007-09-02 Michal Ludvig <michal@logix.cz>
* s3cmd: Initial support for 'sync' operation. For
View
@@ -110,7 +110,8 @@ def bucket_list(self, bucket, prefix = None):
response = self.send_request(request)
#debug(response)
response["list"] = getListFromXml(response["data"], "Contents")
- if getTextFromXml(response['data'], ".//IsTruncated").lower() != "false":
+ is_truncated = getTextFromXml(response['data'], ".//IsTruncated")
+ if is_truncated and is_truncated.lower() != "false":
raise Exception("Listing truncated. Please notify s3cmd developers.")
return response
View
45 s3cmd
@@ -458,28 +458,31 @@ def run_configure(config_file):
output("Success. Your access key and secret key worked fine :-)")
output("\nNow verifying that encryption works...")
- if not getattr(cfg, "gpg_command"):
- raise Exception("Path to GPG program not set")
- if not os.path.isfile(getattr(cfg, "gpg_command")):
- raise Exception("GPG program not found")
- filename = Utils.mktmpfile()
- f = open(filename, "w")
- f.write(os.sys.copyright)
- f.close()
- ret_enc = gpg_encrypt(filename)
- ret_dec = gpg_decrypt(ret_enc[1], ret_enc[2], False)
- hash = [
- Utils.hash_file_md5(filename),
- Utils.hash_file_md5(ret_enc[1]),
- Utils.hash_file_md5(ret_dec[1]),
- ]
- os.unlink(filename)
- os.unlink(ret_enc[1])
- os.unlink(ret_dec[1])
- if hash[0] == hash[2] and hash[0] != hash[1]:
- output ("Success. Encryption and decryption worked fine :-)")
+ if not getattr(cfg, "gpg_command") or not getattr(cfg, "gpg_passphrase"):
+ output("Not configured. Never mind.")
else:
- raise Exception("Encryption verification error.")
+ if not getattr(cfg, "gpg_command"):
+ raise Exception("Path to GPG program not set")
+ if not os.path.isfile(getattr(cfg, "gpg_command")):
+ raise Exception("GPG program not found")
+ filename = Utils.mktmpfile()
+ f = open(filename, "w")
+ f.write(os.sys.copyright)
+ f.close()
+ ret_enc = gpg_encrypt(filename)
+ ret_dec = gpg_decrypt(ret_enc[1], ret_enc[2], False)
+ hash = [
+ Utils.hash_file_md5(filename),
+ Utils.hash_file_md5(ret_enc[1]),
+ Utils.hash_file_md5(ret_dec[1]),
+ ]
+ os.unlink(filename)
+ os.unlink(ret_enc[1])
+ os.unlink(ret_dec[1])
+ if hash[0] == hash[2] and hash[0] != hash[1]:
+ output ("Success. Encryption and decryption worked fine :-)")
+ else:
+ raise Exception("Encryption verification error.")
except Exception, e:
error("Test failed: %s" % (e))

0 comments on commit aa1c976

Please sign in to comment.