How do i pass an empty array to linode-cli invocation?
Hello,
I would like to remove all shared IPs from a linode as stated in linode API docs, however, I am not able to pass an empty array as an argument:
~# linode-cli networking ip-share --linode_id XXXXXX --ips '[]' --json
Request failed: 400
[{"field": "", "reason": "Invalid IP Address []"}]
~# linode-cli networking ip-share --linode_id XXXXXX --ips [] --json
Request failed: 400
[{"field": "", "reason": "Invalid IP Address []"}]
~# linode-cli networking ip-share --linode_id XXXXXX --ips "[]" --json
Request failed: 400
[{"field": "", "reason": "Invalid IP Address []"}]
~# linode-cli networking ip-share --linode_id XXXXXX --ips "\[\]" --json
Request failed: 400
[{"field": "", "reason": "Invalid IP Address \[\]"}]
~# linode-cli networking ip-share --linode_id XXXXXX --ips --json
usage: linode-cli networking ip-share [-h] [--linode_id linode_id] [--ips ips]
linode-cli networking ip-share: error: argument --ips: expected one argument
~# linode-cli networking ip-share --linode_id XXXXXX --ips "" --json
Request failed: 400
[{"field": "", "reason": "Invalid IP Address "}]
Sorry if this is an obvious question, but I couldn't figure it out.
Kind Regards,
Yury
1 Reply
I was able to pass an empty array using the API for a call to a different endpoint, specifically cloning a Linode. This was my API call:
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-X POST -d '{
"region": "us-east",
"type": "g6-standard-2",
"label": "cloned-linode",
"backups_enabled": true,
"disks": [],
"configs": [],
"private_ip": true
}' \
https://api.linode.com/v4/linode/instances/linode_id/clone
However, when I translated this to a CLI command, I received the following error:
linode-cli linodes clone 20747994 \
--region us-east \
--type g6-standard-2 \
--label cloned-ubun22me2 \
--backups_enabled true \
--disks \
--configs \
--private_ip true
usage: linode-cli linodes clone [-h] [--region region] [--type type]
[--linode_id linode_id] [--label label]
[--group group]
[--backups_enabled backups_enabled]
[--disks disks] [--configs configs]
[--private_ip private_ip]
linodeId
linode-cli linodes clone: error: argument --disks: expected one argument
This is not expected behavior. We've reported the issue to the API team for a closer look. Once we hear back from them, we'll be sure to let you know.