Code Monkey home page Code Monkey logo

cloudstack-cloudmonkey's Issues

Error 432 while list publicipaddresses

see below

(local) 🐡 > list publicipaddresses associatednetworkid=Error 432: The given command:listNetscalerLoadBalancerNetworks does not exist or it is not available for user with id:null

cmk add resourcedetail

Hello.

The command "add resourcedetail" works on cloudmonkey 5.3.3, but not on cloudMonkey 6.0.0 (cmk).

$ cmk add resourcedetail resourcetype=UserVm resourceid=5534 details[0].key=nicAdapter details[0].value=Vmxnet3
πŸ’© Missing required parameters: details

$ cloudmonkey add resourcedetail resourcetype=UserVm resourceid=5534 details[0].key=nicAdapter details[0].value=Vmxnet3

{
"accountid": "7cab3d17-1093-11e7-8430-ae828600367e",
"cmd": "org.apache.cloudstack.api.command.user.volume.AddResourceDetailCmd",
"created": "2020-06-01T11:00:22-0300",
"jobid": "d510ceeb-bd8c-4524-b346-f9007a82e1e6",
"jobprocstatus": 0,
"jobresult": {
"success": true
},
"jobresultcode": 0,
"jobresulttype": "object",
"jobstatus": 1,
"userid": "6e5b9999-5fab-43be-9d6e-35abf8f49792"
}
$ cmk list resourcedetails resourceid=5534 resourcetype=UserVm key=nicAdapter {
"count": 1,
"resourcedetail": [
{
"fordisplay": true,
"key": "nicAdapter",
"resourceid": "5534",
"resourcetype": "UserVm",
"value": "Vmxnet3"
}
]
}

Running cmk with -p causes "panic: runtime error: invalid memory address or nil pointer dereference"

If I just run cmk it works fine using the 'default' server profile

>>>>~ $ cmk list virtualmachines | wc -l
    8290
>>>>~ $ cmk
Apache CloudStack 🐡 CloudMonkey 6.0.0-beta2
Report issues: https://github.com/apache/cloudstack-cloudmonkey/issues

(controlled) 🐱 >
>>>>~ $ bat .cmk/config
       β”‚ File: .cmk/config
   6   β”‚ profile    = controlled

But if I specify any profile via -p, including the 'default' it throws:

>>>>~ $ cmk -p controlled
Apache CloudStack 🐡 CloudMonkey 6.0.0-beta2
Report issues: https://github.com/apache/cloudstack-cloudmonkey/issues

(controlled) 🐱 > list virtualmachines
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x40 pc=0x126ee0b]

goroutine 1 [running]:
github.com/apache/cloudstack-cloudmonkey/cmd.NewAPIRequest(0xc000cf2030, 0xc000783340, 0x13, 0xc00072a620, 0x0, 0x0, 0x0, 0x1058500, 0xc0000b1670, 0x49)
	/home/bhaisaab/Lab/apache/cloudmonkey/cmd/network.go:185 +0x23b
github.com/apache/cloudstack-cloudmonkey/cmd.init.0.func1(0xc000cf2030, 0xc000cf2030, 0xc000b80f60)
	/home/bhaisaab/Lab/apache/cloudmonkey/cmd/api.go:79 +0x2af
github.com/apache/cloudstack-cloudmonkey/cli.ExecCmd(0xc00072a620, 0x2, 0x2, 0x2, 0x2)
	/home/bhaisaab/Lab/apache/cloudmonkey/cli/exec.go:67 +0x2d0
github.com/apache/cloudstack-cloudmonkey/cli.ExecLine(0xc000bb0f40, 0x14, 0xc000a55020, 0xc0000b1b28)
	/home/bhaisaab/Lab/apache/cloudmonkey/cli/exec.go:51 +0x166
github.com/apache/cloudstack-cloudmonkey/cli.ExecPrompt.func1(0xc000bb0f40, 0x14)
	/home/bhaisaab/Lab/apache/cloudmonkey/cli/prompt.go:41 +0x39
github.com/c-bata/go-prompt.(*Prompt).Run(0xc000c99080)
	/home/bhaisaab/Lab/apache/cloudmonkey/vendor/github.com/c-bata/go-prompt/prompt.go:85 +0x75b
github.com/apache/cloudstack-cloudmonkey/cli.ExecPrompt()
	/home/bhaisaab/Lab/apache/cloudmonkey/cli/prompt.go:78 +0x49f
main.main()
	/home/bhaisaab/Lab/apache/cloudmonkey/cmk.go:79 +0x257

On MacOS 10.12.6

Web Proxy Support

The implementation of a proxy feature would be great.
http_proxy / https_proxy is not working.

(#54) create tags not work

(ibkcloud) 🐱 > version
Apache CloudStack 🐡 CloudMonkey 6.0.0

(ibkcloud) 🐱 > create tags resourceids=efc9796e-9cef-42b6-a6f8-4e9cd5bffcbd resourcetype=UserVm tags[0].key=someKey tags[0].value=someValue

πŸ’© Missing required parameters: tags

config folder not created at the first execution

the first time cmk is executed, it crash if ~/.cmk folder does not exist. Shouldn't it be created automatically?

cloudstack-cloudmonkey git:(master) ./bin/cmk 
Failed to grab config file lock, please try again
Apache CloudStack 🐡 CloudMonkey 6.0.0-beta1
Report issues: https://github.com/apache/cloudstack-cloudmonkey/issues

Failed to open history file: open /home/pldion/.cmk/history: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x66296a]

goroutine 1 [running]:
github.com/apache/cloudstack-cloudmonkey/config.(*Config).GetPrompt(0xc0001284d0, 0xb, 0xc000c74f60)
	/home/pldion/Documents/apache.org/cloudstack-cloudmonkey/config/prompt.go:51 +0x2a
github.com/apache/cloudstack-cloudmonkey/cli.ExecPrompt()
	/home/pldion/Documents/apache.org/cloudstack-cloudmonkey/cli/prompt.go:48 +0x9a
main.main()
	/home/pldion/Documents/apache.org/cloudstack-cloudmonkey/cmk.go:66 +0x168
➜  cloudstack-cloudmonkey git:(master) mkdir ~/.cmk
➜  cloudstack-cloudmonkey git:(master) ./bin/cmk   
Apache CloudStack 🐡 CloudMonkey 6.0.0-beta1
Report issues: https://github.com/apache/cloudstack-cloudmonkey/issues

(localcloud) 🐱 > quit

But Cool it's golang now, it load much faster :-)

variables in double or single quotes not passed

[root@ref-trl-844-k-M7-pangus-mgmt1 tmp]# service_offering_name="Ultra Tiny"
[root@ref-trl-844-k-M7-pangus-mgmt1 tmp]# cloudmonkey list serviceofferings name=$service_offering_name
[root@ref-trl-844-k-M7-pangus-mgmt1 tmp]# service_offering_name='Ultra Tiny'
[root@ref-trl-844-k-M7-pangus-mgmt1 tmp]# cloudmonkey list serviceofferings name=$service_offering_name
[root@ref-trl-844-k-M7-pangus-mgmt1 tmp]# cloudmonkey list serviceofferings name="Ultra Tiny"
{
"count": 2,
"serviceoffering": [
{
"cpunumber": 1,
"cpuspeed": 500,
"created": "2018-12-09T18:16:15+0000",
"defaultuse": false,
"displaytext": "Ultra Tiny - 1vCPU, 128MB RAM",
"id": "c6ec88c5-504d-42b3-b864-b99fb95f5b9f",
"iscustomized": false,
"issystem": false,
"isvolatile": false,
"limitcpuuse": false,
"memory": 128,
"name": "Ultra Tiny",
"offerha": true,
"provisioningtype": "thin",
"storagetype": "shared"
},
{
"cpunumber": 1,
"cpuspeed": 500,
"created": "2018-12-09T18:17:29+0000",
"defaultuse": false,
"displaytext": "Ultra Tiny - 1vCPU, 128MB RAM",
"id": "337cab06-2c81-4fba-983d-0da54a79734c",
"iscustomized": false,
"issystem": false,
"isvolatile": false,
"limitcpuuse": false,
"memory": 128,
"name": "Ultra Tiny",
"offerha": true,
"provisioningtype": "thin",
"storagetype": "shared"
}
]
}

cloudmonkey -d list serviceofferings name=$service_offering_name
[debug] cmdline args:[cloudmonkey -d list serviceofferings name=Ultra Tiny]
[debug] ExecCmd args: list, serviceofferings, name=Ultra, Tiny
[debug] NewAPIRequest API request URL:http://10.2.2.91:8080/client/api?apiKey=LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q&command=listServiceOfferings&name=Ultra&response=json&signature=Gjv8u3eaY2N%2FD8ZPrw1HIBlU%2F5g%3D
[debug] NewAPIRequest response status code:200
[debug] NewAPIRequest response body:{"listserviceofferingsresponse":{}}

Index out of range exception when autocompleting on list vmsnapshots

index-out-of-range

Steps:

  1. Type list vmsnapshots
  2. tab and the autocompletion option will appear
  3. enter the options 'window'
  4. press arrow down to navigate down

Following exception appears:

(localcloud) SBCM5> > list vmsnapshot panic: runtime error: index out of range

goroutine 1 [running]:
github.com/c-bata/go-prompt.(*CompletionManager).GetSelectedSuggestion(0xc000097d60, 0xc000c860c0, 0xc000097d60, 0x26, 0x0, 0x0)
	/home/shapeblue/Documents/cloudstack-cloudmonkey/vendor/github.com/c-bata/go-prompt/completion.go:50 +0x14c
github.com/c-bata/go-prompt.(*Render).Render(0xc000079790, 0xc000c860c0, 0xc000097d60)
	/home/shapeblue/Documents/cloudstack-cloudmonkey/vendor/github.com/c-bata/go-prompt/render.go:209 +0x360
github.com/c-bata/go-prompt.(*Prompt).Run(0xc000c74800)
	/home/shapeblue/Documents/cloudstack-cloudmonkey/vendor/github.com/c-bata/go-prompt/prompt.go:92 +0x53f
github.com/apache/cloudstack-cloudmonkey/cli.ExecPrompt()
	/home/shapeblue/Documents/cloudstack-cloudmonkey/cli/prompt.go:70 +0x3c7
main.main()
	/home/shapeblue/Documents/cloudstack-cloudmonkey/cmk.go:79 +0x257
[root@trl-1781-v-M7-bstoyanov-mgmt1 ~]#

Provide an option to disable line wrapping in table mode

In table mode, line wrapping is sometimes undesired.

Current output example:


+--------------------------------+
|              NAME              |
+--------------------------------+
| Ubuntu18.04 bionic master      |
| BUILD-47876                    |

Provide an option to suppress line wrapping and enable output like:


+----------------------------------------+
|              NAME                      |
+----------------------------------------+
| Ubuntu18.04 bionic master BUILD-47876  |

Add option to disable autocomplete popup

Feature Request:

After using cmk for awhile, I find the autocomplete popups provided by go-prompt to be quite distracting and would really like to just have tab completion. Any chance we can get an option to turn off the autocomplete popup while still having tab rotate through the available options?

Status responses should not be formatted with %v

When executing a command that returns a status response, such as stop virtualmachine, the response is logged as a simple dump of the Go data structure (like fmt.Printf("%v")), unless the JSON output format was selected.

Since these responses can contain nested data, it makes little sense to print them as a table, CSV or similar format, but the output produced by %v is very hard to read and barely useful for machine consumption.

Please either force JSON output or find a textual/tabular representation that makes sense for nested data structures. Maybe YAML output would be a good candidate?

display tables does not show complete data

Here is a test of list hosts api where using filter for 2 fields: name and oscategoryname which is OS preference in cloudstack UI. if I'm using table output , I only get on column because only one host have the OS preference set. but if I'm using json output I get all the information.

This seams to be true also I filter is not used, where the column oscategoryname is not displayed.

table output that is incorrect: (missing column)

(staging1)  > list hosts filter=oscategoryname,id
count = 13
host:
+--------------------------------------+
|                  ID                  |
+--------------------------------------+
| 1b7d55f0-95bd-4aa0-a247-fa5bc99972cf |
| eb3c8438-c8a0-44ee-a770-797feb684fc9 |
| 1a7c2d6b-e4db-4e53-a623-3f9ba55746de |
| 07cbb1ab-d0c5-43c7-9460-3ce8db7445de |
| 57c2557f-3352-4849-aab3-23237023900b |
| 5baf9623-2099-4ce0-8a1e-2bf6e6f776a6 |
| be0a9906-acec-4bf3-b525-e38aba09a1ee |
| ea90f627-e4ef-40a3-8359-cab5eb7c6e35 |
| 5ff06d4a-d447-4e3e-8c2d-0bc85c013fca |
| 0b2ac79f-6b95-422b-b2f3-72389887a367 |
| 4afd50a7-2140-4d10-94d8-c7c77c005c36 |
| 5307f1c4-8a46-45d8-b5cf-188da557719b |
| f6d8fa63-6b28-4e16-956f-3b140d2f4214 |
+--------------------------------------+
(staging1)  > list hosts filter=oscategoryname
count = 13
host:
+----------------+
| OSCATEGORYNAME |
+----------------+
| Windows        |
+----------------+

json output that expose expected results:

(staging1)  > set display json
(staging1)  > list hosts filter=oscategoryname
{
  "count": 13,
  "host": [
    {},
    {},
    {},
    {},
    {},
    {
      "oscategoryname": "Windows"
    },
    {},
    {},
    {},
    {},
    {},
    {},
    {}
  ]
}
(staging1)  > list hosts filter=oscategoryname,name
{
  "count": 13,
  "host": [
    {
      "name": "stg-xen05"
    },
    {
      "name": "stg-xen06"
    },
    {
      "name": "stg-xen76-01"
    },
    {
      "name": "stg-xen76-02"
    },
    {
      "name": "stg-xen76-03"
    },
    {
      "name": "stg-xen01",
      "oscategoryname": "Windows"
    },
    {
      "name": "s-3438-VM"
    },
    {
      "name": "test-xen01"
    },
    {
      "name": "stg-xen02"
    },
    {
      "name": "stg-xen03"
    },
    {
      "name": "v-3437-VM"
    },
    {
      "name": "stg-xen04"
    },
    {
      "name": "test-xen02"
    }
  ]
}```


I think it's just a matter of suporting empty fields in the table output.

How to filter out not columns but results?

I need to filter a subset of templates matching specific criteria.

Tried for example:

cmk -o table -p admin list templates templatefilter=all filter=id,name,zonename |grep "BUILD-47848"
This does not work well though because of the line breaks in the column "name".

How comes and what to do?

delete

Success is something I will dress for when I get there, and not until.

URL encoded string variables are improperly formatted

variable; extraconfig=%3CmemoryBacking%3E%0D%0A++%3Chugepages%2F%3E%0D%0A%3C%2FmemoryBacking%3E
OR with double quotes
extraconfig="%3CmemoryBacking%3E%0D%0A++%3Chugepages%2F%3E%0D%0A%3C%2FmemoryBacking%3E"

OR with single quote
extraconfig='%3CmemoryBacking%3E%0D%0A++%3Chugepages%2F%3E%0D%0A%3C%2FmemoryBacking%3E'

The following output below was returned as API response from cloudmonkey during execution of the deploy VM API

Old Cloudmonkey:
"details": { "extraconfig-1": "<memoryBacking>\r\n <hugepages/>\r\n</memoryBacking>" },

New CloudMonkey:
"details": { "extraconfig-1": "\u003cmemoryBacking\u003e\r\n \u003chugepages/\u003e\r\n\u003c/memoryBacking\u003e" },

Golang rationale

@PaulAngus @DaanHoogland @GabrielBrascher @mike-tutkowski @rhtyd @rafaelweingartner

It's a calling for a discussion. Is it worth going from Python to Golang? Recently I packed python-based cloudmonkey with pyinstaller into a single executable and it can be deployed as well as a golang binary. I mean that the CloudStack community has some python engineers and it's easier to support the only platform rather than two at once.

I just think that the CloudStack community is not so broad to involve new technologies into the dev stack.

Check: https://www.pyinstaller.org/

Listing default output always gives: Error on parsing and printing 'teal'

Hi all,

I'm running into the error as mentioned in the description. Not sure where (what component or layer) this problem originates. It only occurs when output is default or table. When output is json it's ok.

The cmd/output:

(pce) 🐡 > list securitygroups
Error on parsing and printing 'teal'
count (pce) 🐡 > list users
Error on parsing and printing 'teal'

I'm running latest stable, installed as documented:

$ cat /etc/*release*
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04 LTS"
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Cloudmonkey version:

$ pip search cloudmonkey
cloudmonkey (5.3.3)  - Command Line Interface for Apache CloudStack
  INSTALLED: 5.3.3 (latest)

More info available. Thanks!.

set profile doesn't change the client credentials

(localcloud) SBCM5> > set profile localcloud
Loaded server profile: localcloud
Url:         http://10.2.2.113:8080/client/api
Username:    admin
Domain:      /
API Key:     LIN6rqXuaJwMPfGYFh13qDwYz5VNNz1J2J6qIOWcd3oLQOq0WtD4CwRundBL6rzXToa3lQOC_vKjI3nkHtiD8Q

(localcloud) SBCM5> > sync
Discovered 590 APIs
(localcloud) SBCM5> > set profile something
Loaded server profile: something
Url:         http://localhost:8080/client/api
Username:    admin
Domain:      /
API Key:

(something) SBCM5> > sync
Discovered 590 APIs
(something) SBCM5> >

As you can follow from the snippet above when changing the profile to some new one, one would expect an exception to be thrown when trying to sync. Instead it uses the old credentials for the root admin. Same goes if you try to set url api key ect... it simply does not take them into account but operates with the default ones.

-p argument isn't honoured

The -p command line argument seems to be ignored.

cloudmonkey will simply restore the last used profile on startup, instead of loading the one given after -p .

compilation error: fix gopath/goroot variables in Makefile

I gave it a try and realized that the code does not compile out-of-box from checkout as explained in the instructions.

dingane@dingane-GL553VD:~/apache/cloudstack-cloudmonkey$ make run β–Ά Running gofmt… β–Ά Setting GOPATH… β–Ά Building executable… β–Ά Done! cmk.go:24:2: cannot find package "cloudmonkey/cli" in any of: /usr/lib/go-1.10/src/cloudmonkey/cli (from $GOROOT) /home/dingane/go/src/cloudmonkey/cli (from $GOPATH) cmk.go:25:2: cannot find package "cloudmonkey/config" in any of: /usr/lib/go-1.10/src/cloudmonkey/config (from $GOROOT) /home/dingane/go/src/cloudmonkey/config (from $GOPATH) Makefile:38: recipe for target 'all' failed make: *** [all] Error 1

I was however able to compile and run after manually setting the $GOPATH to the current directory, viz. export GOPATH=$PWD.

If not sudo strange file lock error / CloudMonkey 6.0.0 (build: 74ff37c, 2019-03-05T17:27:26+0530)

Just discovered this exception:


Failed to grab config file lock, please try again
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x6973c1]

goroutine 1 [running]:
github.com/apache/cloudstack-cloudmonkey/config.(*Config).UpdateConfig(0xc0000a84e0, 0x76bbda, 0x6, 0x7ffec3d4f642, 0x5, 0x0)
	/home/rohit/lab/apache/cloudmonkey/config/config.go:283 +0x421
main.main()
	/home/rohit/lab/apache/cloudmonkey/cmk.go:63 +0x45e

Which files does cmk need to lock here?

Workaround: sudo

How to create tags for uservm

create tags resourcetype=uservm resourceids=93b527e7-6d8b-4b82-8a0b-87c5b7ef3fa8 tags='tag[0].key=aaa tag[0].value=444'
Error: (HTTP 431, error code 9999) Unable to execute API command createtags due to invalid value tag[0].key=aaa tag[0].value=444 for parameter tags

create tags resourcetype=uservm resourceids=93b527e7-6d8b-4b82-8a0b-87c5b7ef3fa8 tags=???

tool does not recognize keyword isready for templates

On tab key, "isr" gets extended to "isrecursive". Usage of this keyword yields no result.

Example:

()  > list templates keyword="57152" isready=false templatefilter=all filter=name,isready,status
count = 7
template:
+---------+--------------------------------+-------------------+
| ISREADY |              NAME              |      STATUS       |
+---------+--------------------------------+-------------------+
| true    | Debian10 buster                | Download Complete |
|         | cloudinit-debug BUILD-57152    |                   |
|         | 2019-10-19                     |                   |
| true    | Debian10 buster                | Download Complete |
|         | cloudinit-debug BUILD-57152    |                   |
|         | 2019-10-19                     |                   |
| true    | Debian10 buster                | Download Complete |
|         | cloudinit-debug BUILD-57152    |                   |
|         | 2019-10-19                     |                   |
| true    | Debian10 buster                | Download Complete |
|         | cloudinit-debug BUILD-57152    |                   |
|         | 2019-10-19                     |                   |
| true    | Debian10 buster                | Download Complete |
|         | cloudinit-debug BUILD-57152    |                   |
|         | 2019-10-19                     |                   |
| true    | Debian10 buster                | Download Complete |
|         | cloudinit-debug BUILD-57152    |                   |
|         | 2019-10-19                     |                   |
| true    | Debian10 buster                | Download Complete |
|         | cloudinit-debug BUILD-57152    |                   |
|         | 2019-10-19                     |                   |
+---------+--------------------------------+-------------------+
()  >  

panic: runtime error: invalid memory address or nil pointer dereference

I just gave it a try but ran into this:

wido@wido-laptop:~/Desktop$ ./cmk-linux-amd64 
Please run sync, failed to read the cache file: /home/wido/.cmk/cache
Apache CloudStack 🐡 cloudmonkey 6.0.0-alpha1
Type "help" for details, "sync" to update API cache or press tab to list commands
This is a test/alpha binary, please report issues on https://github.com/apache/cloudstack-cloudmonkey/issues
If you like this, please do star the project on Github!

(local) πŸ™‰ > sync
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x6ee732]

goroutine 1 [running]:
cloudmonkey/cmd.Login(0xc420087650, 0xc420053b38, 0x7b6cd6, 0x8, 0xc420053c80, 0xc4200853a0)
	/home/bhaisaab/Lab/apache/cloudmonkey/.gopath/src/cloudmonkey/cmd/network.go:81 +0x702
cloudmonkey/cmd.NewAPIRequest(0xc420087650, 0x7b6c76, 0x8, 0xc420053d88, 0x1, 0x1, 0x0, 0x1, 0xc420053d98)
	/home/bhaisaab/Lab/apache/cloudmonkey/.gopath/src/cloudmonkey/cmd/network.go:135 +0x59b
cloudmonkey/cmd.init.5.func1(0xc420087650, 0xc420087650, 0xc42008e950)
	/home/bhaisaab/Lab/apache/cloudmonkey/.gopath/src/cloudmonkey/cmd/sync.go:29 +0x7b
cloudmonkey/cli.ExecCmd(0xc420078300, 0xc420085370, 0x1, 0x1, 0xc420162000, 0x1, 0x0)
	/home/bhaisaab/Lab/apache/cloudmonkey/.gopath/src/cloudmonkey/cli/exec.go:34 +0x106
cloudmonkey/cli.ExecShell(0xc420078300)
	/home/bhaisaab/Lab/apache/cloudmonkey/.gopath/src/cloudmonkey/cli/shell.go:91 +0x38e
main.main()
	/home/bhaisaab/Lab/apache/cloudmonkey/cmk.go:38 +0x120
wido@wido-laptop:~/Desktop$ 

This was on a Ubuntu 17.10 system running 64-bit.

Autocomplete hangs for a long time

Whenever I run a command and try to add a parameter, the autocomplete insists on looking up the available options. This lookup can end up taking a very long time for large result sets.

screen shot 2018-11-20 at 1 46 08 pm

Steps to reproduce:
Start typing a command, for example, list virtualmachines projectid=. After the = is typed, cmk attempts to retrieve the available options (I usually just want to use -1 as the project id). This sometimes hangs for me for over 15 seconds. Then, if i start typing and backspace back to the = again...it fetches the options again and takes just as long! The above is just an example, it happens on other commands as well.

cmk 6 - Provide Docker file and publish to Docker hub

The latest version, 6.x seems unavailable as Docker image.

Last updated 3 years ago:
https://hub.docker.com/r/apache/cloudstack-cloudmonkey/

Feature request:

  • add Dockerfile to build cmk
  • publish Docker image to Docker hub

Example working Dockerfile:

FROM debian:sid as builder

WORKDIR /work/
RUN apt -y update && apt -y install git golang-go build-essential &&\
    git clone https://github.com/apache/cloudstack-cloudmonkey.git &&\
    go version &&\
    cd cloudstack-cloudmonkey &&\
    git checkout tags/6.0.0 &&\
    make all &&\
    pwd &&\
    ls -alh ./bin/cmk

FROM debian:stable
COPY --from=builder /work/cloudstack-cloudmonkey/bin/cmk /usr/bin/
RUN apt-get -y update && uname -a && mkdir -p /root/.cmk/ &&\
    cmk version && cmk help && ls -alh /root/

Name resolution doesn't work correctly on Darwin build

There's a known problem with Golang's net DNS code that keeps name resolution from working properly on Mac. Golang binaries compiled for Mac only utilize /etc/resolv.conf, and not the Mac's dynamic, native name resolution libraries.

This is resolved generally by compiling with CGO_ENABLED=1, but you also have to be compiling the Darwin binary on a Mac in order to get it to work.

Users who want a functioning Darwin build of cloudmonkey will need to compile it themselves, enabling CGO, unless the project can produce such binaries and publish them.

See golang/go#31705

Can not login from MacOS

I have done the steps described in the wiki and I am able to confirm the variables have been set correctly by reviewing the ~/.cmk/config file.

I get the error: Failed to login, check credentials and try again.

However, if I just use those credentials in the browser for the same environment, it works.

Also, I notice that if I specify the apikey and secretkey and then try to login, it still requires that I enter a username and password. Why would that be the case? If I have specified the api credentials, why is it asking that I enter additional credentials?

I have also tried just doing a sync rather than a login and I get the following:
Error: (HTTP 401, error code <nil>) unable to verify user credentials

Is there a way to get more verbose logging?

I am accessing the environment over VPN, would that impact this functionality?

System dependencies for the build process?

Hi, all,
what does the following error message mean and what do I need to build cloudmonkey?

Error:

β–Ά  Running gofmt…
flag provided but not defined: -mod
usage: list [-e] [-f format] [-json] [build flags] [packages]

List lists the packages named by the import paths, one per line.

The default output shows the package import path:

Dockerfile:

FROM debian:latest as builder

WORKDIR /work/
RUN apt-get -y update && apt-get -y install git golang-go build-essential &&\
    git clone https://github.com/apache/cloudstack-cloudmonkey.git &&\
    cd cloudstack-cloudmonkey &&\
    make all &&\
    pwd &&\
    ls -alh ./bin/cmk


FROM debian:latest
COPY --from=builder /work/cloudstack-cloudmonkey/bin/cmk /usr/bin/
COPY config /root/.cloudmonkey/config
RUN cmk --version

autocomplete selector is not active until you move with the arrows

Steps:

  1. try listing something by id
  2. when you write 'id=', press tab once
  3. the autocompletion appears
  4. let's say the first selected option is 'medium service' and that's what you need.
  5. press enter
  6. observe that the id is not pasted in the cmd after the 'id=' parameter.

screen shot 2018-09-26 at 16 19 56

Template "details" does not list all details

Compare these two calls: as it seems, template listing does not contain all details information.

CloudMonkey version: 6.0.0

list templates id=8c789ebd-c333-4e22-891a-d49d1c07d95a templatefilter=all filter=id,name,details,

+--------------------------------------+---------------------------+---------------------------------+
|                  ID                  |           NAME            |             DETAILS             |
+--------------------------------------+---------------------------+---------------------------------+
| 408a4ed7-6ce3-4dbb-a937-4c2a1030ddc0 | sles 15 SP1 BUILD-204447b | {"rootDiskController":"pvscsi"} |
+--------------------------------------+---------------------------+---------------------------------+

list resourcedetails resourceid=408a4ed7-6ce3-4dbb-a937-4c2a1030ddc0 resourcetype=Template

+------------+--------------------+------------+--------------+---------+
| FORDISPLAY |        KEY         | RESOURCEID | RESOURCETYPE |  VALUE  |
+------------+--------------------+------------+--------------+---------+
| true       | dataDiskController |       5041 | Template     | pvscsi  |
| true       | nicAdapter         |       5041 | Template     | Vmxnet3 |
| true       | rootDiskController |       5041 | Template     | pvscsi  |


Check for local profile also if localcloud is missing

In earlier cloudmonkey, the default is profile is local and if we use the same config with cmk then it fails as it looks for localcloud in config file. It should work with either localcloud or local as default profile name to preserve backward compatibility

() 🐱 > list zones
Please provide either apikey/secretkey or username/password to make an API call
πŸ™ˆ Error: failed to authenticate to make API call
() 🐱 >

explicitly mentioning local works

# cmk -p local
Apache CloudStack 🐡 CloudMonkey 6.1.0
Report issues: https://github.com/apache/cloudstack-cloudmonkey/issues

(local) 🐱 > list zones
{
  "count": 1,
  "zone": [
    {
      "allocationstate": "Enabled",
      "dhcpprovider": "VirtualRouter",
      "dns1": "8.8.8.8",
      "guestcidraddress": "192.168.10.0/24",
      "id": "8ae93aed-7db1-4a1a-9030-db0efac6ba62",
      "internaldns1": "8.8.4.4",
      "localstorageenabled": false,
      "name": "mgt122-10",
      "networktype": "Advanced",
      "securitygroupsenabled": false,
      "tags": [],
      "zonetoken": "09-97f3-34cf-bba1-5fc23fcb"
    }
  ]
}
(local) 🐱 >

[BLOCKER] Some values cannot be set

Hi Rohit

It appears that new go version of cloudmonkey sends blank values to cloudstack in some cases.

So far i narrowed it down to many "ldap" settings when doing "update configuration" call

CloudMonkey go client
(localcloud) 🐱 > update configuration name=ldap.basedn value='ou=People,dc=ldap,dc=corp,dc=company,dc=com'
{
"configuration": {
"category": "Advanced",
"description": "Sets the basedn for LDAP",
"name": "ldap.basedn"
}
}

notice value above not displayed

CloudMonkey python client
(local) 🐡 > update configuration name=ldap.basedn value='ou=People,dc=ldap,dc=corp,dc=company,dc=com'
{
"configuration": {
"category": "Advanced",
"description": "Sets the basedn for LDAP",
"name": "ldap.basedn",
"value": "ou=People,dc=ldap,dc=corp,dc=company,dc=com"
}
}

works as expected

Please kindly help address this problem - we were hoping to go with CloudMonkey Go Client for simplicity of distribution..

Thanks
ilya

Variables in double quotes get passed with the double quotes (regression)

6.0.0 alpha 2
Previously, if a variable was passed in double quotes, the quotes were stripped.
now they are included, causing failures

svc_offering_id=`cloudmonkey list serviceofferings issystem=true name='System Offering For Software Router' | jq '.serviceoffering[].id'`

echo $svc_offering_id
"b1f32aa1-8d96-4d4c-a466-4287b63af19d"

 cloudmonkey create networkoffering name='Custom Simple Isolated Network Offering' displaytext='Offering for Isolated Network with only DHCP, DNS and User Data' networkrate=1024 guestiptype=Isolated specifyipranges=true specifyvlan=true supportedservices=Dhcp,Dns,UserData traffictype=Guest networkrate=1024 serviceproviderlist[0].provider=VirtualRouter serviceproviderlist[0].service=Dhcp serviceproviderlist[1].provider=VirtualRouter serviceproviderlist[1].service=Dns serviceproviderlist[2].provider=VirtualRouter serviceproviderlist[2].service=UserData serviceofferingid=**$svc_offering_id**

πŸ™ˆ Error: (HTTP 431, error code 9999) Unable to execute API command createnetworkoffering due to invalid value. Invalid parameter serviceofferingid **value="b1f32aa1-8d96-4d4c-a466-4287b63af19d"** due to incorrect long value format, or entity does not exist or due to incorrect parameter annotation for the field in api cmd class.

migrate volume - livemigrate parameter is not parsed?

For volume migration, it seems like CloudMonkey ignores the "livemigrate" parameter regardless if set to true or false, or there is some other problem.

 > migrate volume livemigrate=false volumeid=6e636f90-10d7-4ff4-b2e2-49a10ff7cf12  storageid=65de7617-5025-3d75-ad50-e769556ef72d
jobid = 1a92701f-47d8-40c1-87da-3fe9bc6b2a50
+
+
()  > query asyncjobresult jobid=1a92701f-47d8-40c1-87da-3fe9bc6b2a50
..
jobresultcode = 530
jobresult = map[errorcode:431 errortext:The volume Vol[94836|vm=91495|DATADISK]is attached to a vm and for migrating it the parameter livemigrate should be specified]

Missing prompt characters

There seems to be some missing character in my shell (MATE terminal) at the prompt. Probably the infamous emoji?
selection_359

Fix filtering on various outputs

(cloud) 🐱 > list users account=admin username=admin filter=username
{
  "count": 1,
  "user": [
    {
      "account": "admin",
      "accountid": "###",
      "accounttype": 1,
      "apikey": "###",
      "created": "2017-01-01T00:00:00+0100",
      "domain": "ROOT",
      "domainid": "###",
      "firstname": "admin",
      "id": "###",
      "iscallerchilddomain": false,
      "isdefault": true,
      "lastname": "cloud",
      "roleid": "###",
      "rolename": "Root Admin",
      "roletype": "Admin",
      "secretkey": "###",
      "state": "enabled",
      "username": "admin"
    }
  ]
}

expected output was

{
  "count": 1,
  "user": [
    {
      "username": "admin"
    }
  ]
}

Implement better filtering for autocompletion

When sending actions against a resource, there is no way to filter the autocompletion results, except via fields that the API accepts.

For example, the start virtualmachine API only accepts the VM UUID, which is a global value and almost useless for autocompletion if there are a lot of VMs for the current account.

Please implement a better way to select resources, for example by adding name, project or other arguments that would query the respective APIs for a list of resources first.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.