Power parameters for VMware in MaaS CLI












0















I am playing with MaaS in a vSphere environment so I can simulate large clusters. I have finished my auto-provisioning PowerShell script, where I can provision a bunch of virtual machines to be added to the MaaS controller. I can add these nodes manually in the Controller GUI and I was able to commission them accordingly. I'm currently trying to figure out how to add the machines via the MaaS CLI, and I'm stuck on the power_parameters parameter. Based off the MaaS API documentation, I have to add everything as a key=value type.



Where I'm stuck is on how to add that parameter in the CLI. If I don't pass power_parameters, I get this error:



400 BAD REQUEST

Content-Type: application/json; charset=utf-8
Date: Mon, 25 Mar 2019 21:01:03 GMT
Server: TwistedWeb/16.0.0
Status: 400
Transfer-Encoding: chunked
Vary: Cookie
X-Frame-Options: SAMEORIGIN

{"power_parameters": ["This field is required."]}


But I cannot figure out the proper string formatting for the parameter. I have tried several combos:



# tried adding it as a string as the docs say
maas <user> machines create -d
...
power_parameters="power_vm_name=<vmname> power_uuid=<vmuuid>"

# tried query string separating
maas <user> machines create -d
...
power_parameters="power_vm_name=<vmname>&power_uuid=<vmuuid>"

# tried comma separating
maas <user> machines create -d
...
power_parameters=power_vm_name=<vmname>,power_uuid=<vmuuid>

# tried individual parameters
maas <user> machines create -d
...
power_vm_name=<vmname> power_uuid=<vmuuid>


I get this error with every permutation I've tried:



400 BAD REQUEST

Content-Type: text/plain; charset=utf-8
Date: Mon, 25 Mar 2019 20:54:24 GMT
Server: TwistedWeb/16.0.0
Status: 400
Transfer-Encoding: chunked
Vary: Cookie
X-Frame-Options: SAMEORIGIN

Failed to parse JSON power_parameters


I know I can send the raw JSON payload via REST, but I don't really want to implement a REST client in PowerShell for MaaS.



What is the proper string formatting for adding power_parameters in the MaaS CLI?










share|improve this question



























    0















    I am playing with MaaS in a vSphere environment so I can simulate large clusters. I have finished my auto-provisioning PowerShell script, where I can provision a bunch of virtual machines to be added to the MaaS controller. I can add these nodes manually in the Controller GUI and I was able to commission them accordingly. I'm currently trying to figure out how to add the machines via the MaaS CLI, and I'm stuck on the power_parameters parameter. Based off the MaaS API documentation, I have to add everything as a key=value type.



    Where I'm stuck is on how to add that parameter in the CLI. If I don't pass power_parameters, I get this error:



    400 BAD REQUEST

    Content-Type: application/json; charset=utf-8
    Date: Mon, 25 Mar 2019 21:01:03 GMT
    Server: TwistedWeb/16.0.0
    Status: 400
    Transfer-Encoding: chunked
    Vary: Cookie
    X-Frame-Options: SAMEORIGIN

    {"power_parameters": ["This field is required."]}


    But I cannot figure out the proper string formatting for the parameter. I have tried several combos:



    # tried adding it as a string as the docs say
    maas <user> machines create -d
    ...
    power_parameters="power_vm_name=<vmname> power_uuid=<vmuuid>"

    # tried query string separating
    maas <user> machines create -d
    ...
    power_parameters="power_vm_name=<vmname>&power_uuid=<vmuuid>"

    # tried comma separating
    maas <user> machines create -d
    ...
    power_parameters=power_vm_name=<vmname>,power_uuid=<vmuuid>

    # tried individual parameters
    maas <user> machines create -d
    ...
    power_vm_name=<vmname> power_uuid=<vmuuid>


    I get this error with every permutation I've tried:



    400 BAD REQUEST

    Content-Type: text/plain; charset=utf-8
    Date: Mon, 25 Mar 2019 20:54:24 GMT
    Server: TwistedWeb/16.0.0
    Status: 400
    Transfer-Encoding: chunked
    Vary: Cookie
    X-Frame-Options: SAMEORIGIN

    Failed to parse JSON power_parameters


    I know I can send the raw JSON payload via REST, but I don't really want to implement a REST client in PowerShell for MaaS.



    What is the proper string formatting for adding power_parameters in the MaaS CLI?










    share|improve this question

























      0












      0








      0








      I am playing with MaaS in a vSphere environment so I can simulate large clusters. I have finished my auto-provisioning PowerShell script, where I can provision a bunch of virtual machines to be added to the MaaS controller. I can add these nodes manually in the Controller GUI and I was able to commission them accordingly. I'm currently trying to figure out how to add the machines via the MaaS CLI, and I'm stuck on the power_parameters parameter. Based off the MaaS API documentation, I have to add everything as a key=value type.



      Where I'm stuck is on how to add that parameter in the CLI. If I don't pass power_parameters, I get this error:



      400 BAD REQUEST

      Content-Type: application/json; charset=utf-8
      Date: Mon, 25 Mar 2019 21:01:03 GMT
      Server: TwistedWeb/16.0.0
      Status: 400
      Transfer-Encoding: chunked
      Vary: Cookie
      X-Frame-Options: SAMEORIGIN

      {"power_parameters": ["This field is required."]}


      But I cannot figure out the proper string formatting for the parameter. I have tried several combos:



      # tried adding it as a string as the docs say
      maas <user> machines create -d
      ...
      power_parameters="power_vm_name=<vmname> power_uuid=<vmuuid>"

      # tried query string separating
      maas <user> machines create -d
      ...
      power_parameters="power_vm_name=<vmname>&power_uuid=<vmuuid>"

      # tried comma separating
      maas <user> machines create -d
      ...
      power_parameters=power_vm_name=<vmname>,power_uuid=<vmuuid>

      # tried individual parameters
      maas <user> machines create -d
      ...
      power_vm_name=<vmname> power_uuid=<vmuuid>


      I get this error with every permutation I've tried:



      400 BAD REQUEST

      Content-Type: text/plain; charset=utf-8
      Date: Mon, 25 Mar 2019 20:54:24 GMT
      Server: TwistedWeb/16.0.0
      Status: 400
      Transfer-Encoding: chunked
      Vary: Cookie
      X-Frame-Options: SAMEORIGIN

      Failed to parse JSON power_parameters


      I know I can send the raw JSON payload via REST, but I don't really want to implement a REST client in PowerShell for MaaS.



      What is the proper string formatting for adding power_parameters in the MaaS CLI?










      share|improve this question














      I am playing with MaaS in a vSphere environment so I can simulate large clusters. I have finished my auto-provisioning PowerShell script, where I can provision a bunch of virtual machines to be added to the MaaS controller. I can add these nodes manually in the Controller GUI and I was able to commission them accordingly. I'm currently trying to figure out how to add the machines via the MaaS CLI, and I'm stuck on the power_parameters parameter. Based off the MaaS API documentation, I have to add everything as a key=value type.



      Where I'm stuck is on how to add that parameter in the CLI. If I don't pass power_parameters, I get this error:



      400 BAD REQUEST

      Content-Type: application/json; charset=utf-8
      Date: Mon, 25 Mar 2019 21:01:03 GMT
      Server: TwistedWeb/16.0.0
      Status: 400
      Transfer-Encoding: chunked
      Vary: Cookie
      X-Frame-Options: SAMEORIGIN

      {"power_parameters": ["This field is required."]}


      But I cannot figure out the proper string formatting for the parameter. I have tried several combos:



      # tried adding it as a string as the docs say
      maas <user> machines create -d
      ...
      power_parameters="power_vm_name=<vmname> power_uuid=<vmuuid>"

      # tried query string separating
      maas <user> machines create -d
      ...
      power_parameters="power_vm_name=<vmname>&power_uuid=<vmuuid>"

      # tried comma separating
      maas <user> machines create -d
      ...
      power_parameters=power_vm_name=<vmname>,power_uuid=<vmuuid>

      # tried individual parameters
      maas <user> machines create -d
      ...
      power_vm_name=<vmname> power_uuid=<vmuuid>


      I get this error with every permutation I've tried:



      400 BAD REQUEST

      Content-Type: text/plain; charset=utf-8
      Date: Mon, 25 Mar 2019 20:54:24 GMT
      Server: TwistedWeb/16.0.0
      Status: 400
      Transfer-Encoding: chunked
      Vary: Cookie
      X-Frame-Options: SAMEORIGIN

      Failed to parse JSON power_parameters


      I know I can send the raw JSON payload via REST, but I don't really want to implement a REST client in PowerShell for MaaS.



      What is the proper string formatting for adding power_parameters in the MaaS CLI?







      command-line juju maas






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      mxplusbmxplusb

      12317




      12317






















          1 Answer
          1






          active

          oldest

          votes


















          1














          So, I ripped apart the MaaS CLI code base, and I saw lots of references to power_parameters_<param> in the code base, which led me to believe it's looking for a specific key formatting.



          This is what ended up working for me:



          maas <user> machines create -d \
          architecture=amd64
          mac_addresses=<mac>
          domain=<domain>
          hostname=<name>
          power_type=vmware
          power_parameters_power_vm_name=<vm_name>
          power_parameters_power_uuid=<vm_uuid>
          power_parameters_power_address=<vcenter_host_name>
          power_parameters_power_user='<maas_user_in_quotes>'
          power_parameters_power_pass='<password_in_quotes>'
          power_parameters_power_port=443
          power_parameters_power_protocol=https+unverified


          I was then able to see the machine in the Controller UI.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1128658%2fpower-parameters-for-vmware-in-maas-cli%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            So, I ripped apart the MaaS CLI code base, and I saw lots of references to power_parameters_<param> in the code base, which led me to believe it's looking for a specific key formatting.



            This is what ended up working for me:



            maas <user> machines create -d \
            architecture=amd64
            mac_addresses=<mac>
            domain=<domain>
            hostname=<name>
            power_type=vmware
            power_parameters_power_vm_name=<vm_name>
            power_parameters_power_uuid=<vm_uuid>
            power_parameters_power_address=<vcenter_host_name>
            power_parameters_power_user='<maas_user_in_quotes>'
            power_parameters_power_pass='<password_in_quotes>'
            power_parameters_power_port=443
            power_parameters_power_protocol=https+unverified


            I was then able to see the machine in the Controller UI.






            share|improve this answer




























              1














              So, I ripped apart the MaaS CLI code base, and I saw lots of references to power_parameters_<param> in the code base, which led me to believe it's looking for a specific key formatting.



              This is what ended up working for me:



              maas <user> machines create -d \
              architecture=amd64
              mac_addresses=<mac>
              domain=<domain>
              hostname=<name>
              power_type=vmware
              power_parameters_power_vm_name=<vm_name>
              power_parameters_power_uuid=<vm_uuid>
              power_parameters_power_address=<vcenter_host_name>
              power_parameters_power_user='<maas_user_in_quotes>'
              power_parameters_power_pass='<password_in_quotes>'
              power_parameters_power_port=443
              power_parameters_power_protocol=https+unverified


              I was then able to see the machine in the Controller UI.






              share|improve this answer


























                1












                1








                1







                So, I ripped apart the MaaS CLI code base, and I saw lots of references to power_parameters_<param> in the code base, which led me to believe it's looking for a specific key formatting.



                This is what ended up working for me:



                maas <user> machines create -d \
                architecture=amd64
                mac_addresses=<mac>
                domain=<domain>
                hostname=<name>
                power_type=vmware
                power_parameters_power_vm_name=<vm_name>
                power_parameters_power_uuid=<vm_uuid>
                power_parameters_power_address=<vcenter_host_name>
                power_parameters_power_user='<maas_user_in_quotes>'
                power_parameters_power_pass='<password_in_quotes>'
                power_parameters_power_port=443
                power_parameters_power_protocol=https+unverified


                I was then able to see the machine in the Controller UI.






                share|improve this answer













                So, I ripped apart the MaaS CLI code base, and I saw lots of references to power_parameters_<param> in the code base, which led me to believe it's looking for a specific key formatting.



                This is what ended up working for me:



                maas <user> machines create -d \
                architecture=amd64
                mac_addresses=<mac>
                domain=<domain>
                hostname=<name>
                power_type=vmware
                power_parameters_power_vm_name=<vm_name>
                power_parameters_power_uuid=<vm_uuid>
                power_parameters_power_address=<vcenter_host_name>
                power_parameters_power_user='<maas_user_in_quotes>'
                power_parameters_power_pass='<password_in_quotes>'
                power_parameters_power_port=443
                power_parameters_power_protocol=https+unverified


                I was then able to see the machine in the Controller UI.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                mxplusbmxplusb

                12317




                12317






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1128658%2fpower-parameters-for-vmware-in-maas-cli%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    香粉寮

                    GameSpot