cloudstack-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco Giovannini <usern...@gmail.com>
Subject Re: cloudmonkey - account name with spaces
Date Thu, 09 Jul 2015 07:44:18 GMT
Hi

I tried the double quote but the issue persist :(.

Currently I'm using cloudmonkey 5.2.0 and I can not change it at the moment
in the production env so I'm testing  a more recent version in my test env
but that part of the code did not change so I suppose I will face the same
issue.

Regards,
Marco

On Wed, Jul 8, 2015 at 6:09 PM, Rohit Yadav <rohit.yadav@shapeblue.com>
wrote:

>  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 <usernkey@gmail.com> wrote:
>
> Hi
>
> after a deeper investigation I think the  issue is in the cloudmonkey.py
> 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):
>            return
>
>        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 = lexp.next()
>            if next_val is None:
>                break
>            args.append(next_val.replace('\x00', ''))
>
>        args_dict = dict(map(lambda x: [x.partition("=")[0],
>                                        x.partition("=")[2]],
>                             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(),
>                                      args_dict.pop('filter').split(',')))
>
>        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],
>                             self.apicache[verb][subject]['requiredparams'])
>
>        if len(missing) > 0:
>            self.monkeyprint("Missing arguments: ", ' '.join(missing))
>            return
>
>        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:
>            return
>        try:
>            responsekeys = filter(lambda x: 'response' in x, result.keys())
>            for responsekey in responsekeys:
>                self.print_result(result[responsekey], field_filter)
>            print
>        except Exception as e:
>            self.monkeyprint("🙈  Error on parsing and printing", e)
>
>
>
> Regards,
> Marco
>
> On Tue, Jul 7, 2015 at 7:44 PM, Nick Brody <nickbrody2014@gmail.com>
> wrote:
>
> thanks mate
>
> On Tue, Jul 7, 2015 at 4:06 AM, Marco Giovannini <usernkey@gmail.com>
> wrote:
>
> Hi
>
> 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*'
> domainid=9f33d216-cd9e-485a-9858-e5805afe8097
> virtualmachineid=96aa0da7-29ca-48a7-b928-b73052933e21
> networkids=ff1567f0-0820-4116-98b1-c79a55120356
>
> This command is giving me back the following error
>
>
> nt/api', 'expires=600',
>
>
> 'secretkey=g_fBs2UpAJQSu0CfL8s5hVhC0wTaEkYfQITT1v81fW87wSXduZvBqOKAgJsq_Y4Q48JXnfUD9Cjn9SerbaoprA',
> 'timeout=3600', 'password=password']
> 2015-07-07 10:47:37,578 - requester.py:41 - [DEBUG] ======== START Request
> ========
> 2015-07-07 10:47:37,579 - requester.py:41 - [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 - requester.py:41 - [DEBUG] Request sent:
>
> http://inth1-vdc-pcpman2.pargar.cp.vdc:8080/client/api?
> account=Interoute&apiKey=YpMzLF_JyICbhmHKTlhW16B0NntlX210T5XAZlILM8L85qYDaNaRKdNBIQp-hniVPFkMjeQuLQxjynrUplBp8Q&command=assignVirtualMachine&domainid=9f33d216-cd9e-485a-9858-e5805afe8097&expires=2015-07-07T10%3A57%3A37%2B0000&Management=&networkids=ff1567f0-0820-4116-98b1-c79a55120356&response=json&signatureversion=3&VDC=&virtualmachineid=96aa0da7-29ca-48a7-b928-b73052933e21&signature=el38MIugRpFdSatTT9FU93rfrr8%3D
> 2015-07-07
> <
> http://inth1-vdc-pcpman2.pargar.cp.vdc:8080/client/api?account=Interoute&apiKey=YpMzLF_JyICbhmHKTlhW16B0NntlX210T5XAZlILM8L85qYDaNaRKdNBIQp-hniVPFkMjeQuLQxjynrUplBp8Q&command=assignVirtualMachine&domainid=9f33d216-cd9e-485a-9858-e5805afe8097&expires=2015-07-07T10%3A57%3A37%2B0000&Management=&networkids=ff1567f0-0820-4116-98b1-c79a55120356&response=json&signatureversion=3&VDC=&virtualmachineid=96aa0da7-29ca-48a7-b928-b73052933e21&signature=el38MIugRpFdSatTT9FU93rfrr8%3D2015-07-07
> >
> 10:47:37,675 - requester.py:41 - [DEBUG] Response received: None
> 2015-07-07 10:47:37,675 - requester.py:41 -* [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
> or
> substitute the space with %20 but nothing worked.
>
> Is the any known workaround  to get rid of this issue?
>
> Regards,
> Marco
>
>
>
>
> Regards,
> Rohit Yadav
> Software Architect, ShapeBlue
>
>
>
>
> M. +91 88 262 30892 | rohit.yadav@shapeblue.com
> Blog: bhaisaab.org | Twitter: @_bhaisaab
>
>
>
>
>  Find out more about ShapeBlue and our range of CloudStack related
> services
>
> IaaS Cloud Design & Build
> <http://shapeblue.com/iaas-cloud-design-and-build//>
> CSForge – rapid IaaS deployment framework <http://shapeblue.com/csforge/>
> CloudStack Consulting <http://shapeblue.com/cloudstack-consultancy/>
> CloudStack Software Engineering
> <http://shapeblue.com/cloudstack-software-engineering/>
> CloudStack Infrastructure Support
> <http://shapeblue.com/cloudstack-infrastructure-support/>
> CloudStack Bootcamp Training Courses
> <http://shapeblue.com/cloudstack-training/>
>
> 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.
>

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message