You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2015/05/22 19:03:19 UTC
[1/3] cloudstack-cloudmonkey git commit: Provide signatureversion as
config.option for backward compatibility;
Repository: cloudstack-cloudmonkey
Updated Branches:
refs/heads/master a78a0d20e -> 758597c5f
Provide signatureversion as config.option for backward compatibility;
Follow specification: only provide signatureversion=&expires= in URL if signatureversion=3
http://docs.cloudstack.apache.org/en/latest/dev.html?highlight=signatureversion
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
This closes #6
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/758597c5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/758597c5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/758597c5
Branch: refs/heads/master
Commit: 758597c5fba3b6ff07bdf9752b1eafcaca221116
Parents: 6bd9239
Author: Nuno Tavares <n....@tech.leaseweb.com>
Authored: Fri May 22 16:05:07 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri May 22 18:01:33 2015 +0100
----------------------------------------------------------------------
cloudmonkey/cloudmonkey.py | 5 +++--
cloudmonkey/config.py | 1 +
cloudmonkey/requester.py | 18 ++++++++++--------
3 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/758597c5/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index a305c36..6beb45d 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -117,7 +117,7 @@ class CloudMonkeyShell(cmd.Cmd, object):
def init_credential_store(self):
self.credentials = {'apikey': self.apikey, 'secretkey': self.secretkey,
'domain': self.domain, 'username': self.username,
- 'password': self.password}
+ 'password': self.password, 'signatureversion': self.signatureversion}
parsed_url = urlparse(self.url)
self.protocol = "http" if not parsed_url.scheme else parsed_url.scheme
self.host = parsed_url.netloc
@@ -319,7 +319,8 @@ class CloudMonkeyShell(cmd.Cmd, object):
self.asyncblock, logger,
self.url, self.credentials,
self.timeout, self.expires,
- self.verifysslcert == 'true')
+ self.verifysslcert == 'true',
+ self.signatureversion)
if error:
self.monkeyprint(u"Error {0}".format(error))
self.error_on_last_command = True
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/758597c5/cloudmonkey/config.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/config.py b/cloudmonkey/config.py
index 21063f0..d92df25 100644
--- a/cloudmonkey/config.py
+++ b/cloudmonkey/config.py
@@ -73,6 +73,7 @@ default_profile['domain'] = '/'
default_profile['apikey'] = ''
default_profile['secretkey'] = ''
default_profile['verifysslcert'] = 'true'
+default_profile['signatureversion'] = '3'
def write_config(get_attr, config_file):
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/758597c5/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py
index cfe677f..4cf9d2a 100644
--- a/cloudmonkey/requester.py
+++ b/cloudmonkey/requester.py
@@ -159,7 +159,7 @@ def make_request_with_password(command, args, logger, url, credentials,
def make_request(command, args, logger, url, credentials, expires,
- verifysslcert=False):
+ verifysslcert=False,signatureversion=3):
result = None
error = None
@@ -174,11 +174,13 @@ def make_request(command, args, logger, url, credentials, expires,
args = args.copy()
args["command"] = command
args["response"] = "json"
- args["signatureversion"] = "3"
- if not expires:
- expires = 600
- expirationtime = datetime.utcnow() + timedelta(seconds=int(expires))
- args["expires"] = expirationtime.strftime('%Y-%m-%dT%H:%M:%S+0000')
+ signatureversion = int(signatureversion)
+ if signatureversion >= 3:
+ args["signatureversion"] = signatureversion
+ if not expires:
+ expires = 600
+ expirationtime = datetime.utcnow() + timedelta(seconds=int(expires))
+ args["expires"] = expirationtime.strftime('%Y-%m-%dT%H:%M:%S+0000')
for key in args.keys():
value = args[key]
@@ -246,13 +248,13 @@ def make_request(command, args, logger, url, credentials, expires,
def monkeyrequest(command, args, isasync, asyncblock, logger, url,
- credentials, timeout, expires, verifysslcert=False):
+ credentials, timeout, expires, verifysslcert=False, signatureversion=3):
response = None
error = None
logger_debug(logger, "======== START Request ========")
logger_debug(logger, "Requesting command=%s, args=%s" % (command, args))
response, error = make_request(command, args, logger, url,
- credentials, expires, verifysslcert)
+ credentials, expires, verifysslcert, signatureversion)
logger_debug(logger, "======== END Request ========\n")
[2/3] cloudstack-cloudmonkey git commit: FIX some parameters are
double encoded (UI uses javascript to encode on the fly,
see ui/scripts/accounts.js:1852),
such as registerSSHKeyPair/publickey. I did a quick search for other cases,
bu there may be more p
Posted by bh...@apache.org.
FIX some parameters are double encoded (UI uses javascript to encode on the fly, see ui/scripts/accounts.js:1852), such as registerSSHKeyPair/publickey. I did a quick search for other cases, bu there may be more parameters.
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/6bd92395
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/6bd92395
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/6bd92395
Branch: refs/heads/master
Commit: 6bd92395592c133a63b8087bf4acc9cb3a1aac0d
Parents: 830858a
Author: Nuno Tavares <n....@tech.leaseweb.com>
Authored: Fri May 22 16:01:48 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri May 22 18:01:33 2015 +0100
----------------------------------------------------------------------
cloudmonkey/requester.py | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/6bd92395/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/requester.py b/cloudmonkey/requester.py
index b01aa5c..cfe677f 100644
--- a/cloudmonkey/requester.py
+++ b/cloudmonkey/requester.py
@@ -187,6 +187,9 @@ def make_request(command, args, logger, url, credentials, expires,
args[key] = value
if not key:
args.pop(key)
+ else:
+ if key in ['publickey', 'privatekey', 'certificate']:
+ args[key] = urllib.quote_plus(str(value))
# try to use the apikey/secretkey method by default
# followed by trying to check if we're using integration port
[3/3] cloudstack-cloudmonkey git commit: FIX split for paramter=value
where value could be anything. An example case where value can contain the
"=" sign: registerSSHKeyPair (publickey)
Posted by bh...@apache.org.
FIX split for paramter=value where value could be anything. An example case where value can contain the "=" sign: registerSSHKeyPair (publickey)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/commit/830858a3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/tree/830858a3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/diff/830858a3
Branch: refs/heads/master
Commit: 830858a35a11f62bddbae4fda1c0f1b5c389caed
Parents: a78a0d2
Author: Nuno Tavares <n....@tech.leaseweb.com>
Authored: Fri May 22 16:00:43 2015 +0200
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Fri May 22 18:01:33 2015 +0100
----------------------------------------------------------------------
cloudmonkey/cloudmonkey.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack-cloudmonkey/blob/830858a3/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/cloudmonkey/cloudmonkey.py b/cloudmonkey/cloudmonkey.py
index b8b4e77..a305c36 100644
--- a/cloudmonkey/cloudmonkey.py
+++ b/cloudmonkey/cloudmonkey.py
@@ -799,7 +799,7 @@ def main():
shell.set_attr("color", "false")
commands = []
for command in args.commands:
- split_command = command.split("=")
+ split_command = command.split("=", 1)
if len(split_command) > 1:
key = split_command[0]
value = split_command[1]