cloudstack-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rohit Yadav <>
Subject Re: cloudmonkey - account name with spaces
Date Wed, 08 Jul 2015 16:09:28 GMT
Hi Marco,

Are you using the latest version, CloudMonkey 5.3.1?

Can you try using double quotes? Like: assign virtualmachine account=“string1 string2”
(CloudMonkey using shlex, fyi)

The account parameter for the API should be provided as is (in case you were trying to do
wild card search using a star - *).

Hope this helps.

On 08-Jul-2015, at 7:34 pm, Marco Giovannini <<>>


after a deeper investigation I think the  issue is in the
in the following function as it is using space as delimiter for the options
of the command.

I will install a cloudmonkey in my test environment and I'll see if I'm
right and able to fix it.

   def default(self, args):
       if self.pipe_runner(args):

       apiname = args.partition(' ')[0]
       verb, subject = splitverbsubject(apiname)

       lexp = shlex.shlex(args.strip())
       lexp.whitespace = " "
*        lexp.whitespace_split = True*
       lexp.posix = True
       args = []
       while True:
           next_val =
           if next_val is None:
           args.append(next_val.replace('\x00', ''))

       args_dict = dict(map(lambda x: [x.partition("=")[0],
                            args[1:])[x] for x in range(len(args) - 1))
       field_filter = None
       if 'filter' in args_dict:
           field_filter = filter(lambda x: x is not '',
                                 map(lambda x: x.strip(),

       missing = []
       if verb in self.apicache and subject in self.apicache[verb]:
           missing = filter(lambda x: x not in [key.split('[')[0]
                                                for key in args_dict],

       if len(missing) > 0:
           self.monkeyprint("Missing arguments: ", ' '.join(missing))

       isasync = False
       if 'asyncapis' in self.apicache:
           isasync = apiname in self.apicache['asyncapis']

       result = self.make_request(apiname, args_dict, isasync)

       if result is None:
           responsekeys = filter(lambda x: 'response' in x, result.keys())
           for responsekey in responsekeys:
               self.print_result(result[responsekey], field_filter)
       except Exception as e:
           self.monkeyprint("🙈  Error on parsing and printing", e)


On Tue, Jul 7, 2015 at 7:44 PM, Nick Brody <<>>

thanks mate

On Tue, Jul 7, 2015 at 4:06 AM, Marco Giovannini <<>>


I'm using Cloudstack 4.3.X. and  I need to  use cloudmonkey to perform the
task of assigning the vm instance to another user (I did not find a way to
do from the web interface in one step)

I'm using the following command:

assign virtualmachine *account='Part1 Part2 Part3*'

This command is giving me back the following error

nt/api', 'expires=600',

'timeout=3600', 'password=password']
2015-07-07 10:47:37,578 - - [DEBUG] ======== START Request
2015-07-07 10:47:37,579 - - [DEBUG] Requesting
command=assignVirtualMachine, args={'networkids':
'ff1567f0-0820-4116-98b1-c79a55120356',* 'Part3': ''*, 'virtualmachineid':
'96aa0da7-29ca-48a7-b928-b73052933e21', *'account': 'Part1', 'Part2':* '',
'domainid': '9f33d216-cd9e-485a-9858-e5805afe8097'}
2015-07-07 10:47:37,579 - - [DEBUG] Request sent:

10:47:37,675 - - [DEBUG] Response received: None
2015-07-07 10:47:37,675 - -* [DEBUG] Error:
Error:Unauthorized None*

As  you  can see the account name with spaces is messing up the account
name used in the call and this is the reason I get the unauthorized error.

I tried different way to put the account name, with quote  without quote
substitute the space with %20 but nothing worked.

Is the any known workaround  to get rid of this issue?


Rohit Yadav
Software Architect, ShapeBlue


M. +91 88 262 30892 |<>
Blog:<> | Twitter: @_bhaisaab

Find out more about ShapeBlue and our range of CloudStack related services

IaaS Cloud Design & Build<>
CSForge – rapid IaaS deployment framework<>
CloudStack Consulting<>
CloudStack Software Engineering<>
CloudStack Infrastructure Support<>
CloudStack Bootcamp Training Courses<>

This email and any attachments to it may be confidential and are intended solely for the use
of the individual to whom it is addressed. Any views or opinions expressed are solely those
of the author and do not necessarily represent those of Shape Blue Ltd or related companies.
If you are not the intended recipient of this email, you must neither take any action based
upon its contents, nor copy or show it to anyone. Please contact the sender if you believe
you have received this email in error. Shape Blue Ltd is a company incorporated in England
& Wales. ShapeBlue Services India LLP is a company incorporated in India and is operated
under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company incorporated
in Brasil and is operated under license from Shape Blue Ltd. ShapeBlue SA Pty Ltd is a company
registered by The Republic of South Africa and is traded under license from Shape Blue Ltd.
ShapeBlue is a registered trademark.
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message