Coder Social home page Coder Social logo

linode / linode-cli Goto Github PK

View Code? Open in Web Editor NEW
372.0 31.0 130.0 1.89 MB

The official Linode command line interface.

Home Page: https://linode.com

License: BSD 3-Clause "New" or "Revised" License

Python 98.58% Makefile 0.36% Shell 0.51% Dockerfile 0.08% HTML 0.47%
linode cloud infrastructure command-line-tool

linode-cli's Introduction

linode-cli (lin)

The Linode Command Line Interface

Provides easy access to any of the Linode API endpoints from the command line and displays results in an organized, configurable table.

This project is automatically generated from the Linode OpenAPI spec using the openapi3 Python package.

Example of CLI in use

Visit the Wiki for more information.

Install

Install via PyPI:

pip3 install linode-cli

Visit the Wiki for more information.

Contributing

This CLI is generated from the OpenAPI specification for Linode's API. As such, many changes are made directly to the spec.

Please follow the Contributing Guidelines when making a contribution.

linode-cli's People

Contributors

alsaihn avatar alxbl avatar amisiorek-akamai avatar asauber avatar chenrui333 avatar cofyc avatar dependabot[bot] avatar dorthu avatar ezilber-akamai avatar ezilber-akamai-zz avatar ginkgomzd avatar jafreche-akamai avatar jriddle-linode avatar lbgarber avatar leslitagordita avatar lgarber-akamai avatar michaelsaah avatar patthiel avatar phillc avatar rcsalome avatar rmcintosh avatar sarahelizgray avatar stvhwrd avatar tjhop avatar victoriaroan avatar vshanthe avatar yec-akamai avatar ykim-1 avatar yoshizzle avatar zliang-akamai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

linode-cli's Issues

Pypi project name different from file download

I was trying to package linode-cli for NixOS and I noticed a couple issues with the release artifacts. I'll post a separate issues about them.

The pypi project name is linode-cli, but the first part of the file download is linode_cli in https://files.pythonhosted.org/packages/18/3f/4820d8353159394601a55f08d49073e9ba88b194c9ef15afaa5f38e1cce3/linode_cli-2.0.0-py2.py3-none-any.whl

It would be nice if those names were the same.

It's also a bit unfortunate that this project has the exact same name as the Perl-based binary published by Linode.

linode list generates AttributeError: 'NoneType' object has no attribute 'storage'

linode-cli list
Linode
┌─────────────┬─────────┬────────────┬─────────┬─────────┬──────┐
│ label       │ status  │ location   │ backups │ storage │ ram  │
├─────────────┼─────────┼────────────┼─────────┼─────────┼──────┤
│ salt-master │ running │ Newark, NJ │ yes     │ 20480   │ 1024 │
│ nagios      │ running │ Newark, NJ │ yes     │ 20480   │ 1024 │
│ urmom       │ running │ Newark, NJ │ yes     │ 20480   │ 1024 │
│ cowrie      │ running │ Newark, NJ │ yes     │ 20480   │ 1024 │
└─────────────┴─────────┴────────────┴─────────┴─────────┴──────┘
Work
Traceback (most recent call last):
  File "/usr/local/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/linodecli/cli.py", line 85, in main
    getattr(obj, cmd)(args, client, unparsed=unparsed)
  File "/usr/local/lib/python3.6/site-packages/linodecli/resources/linode.py", line 88, in list
    data = [ _make_linode_row(l) for l in groups[k] ]
  File "/usr/local/lib/python3.6/site-packages/linodecli/resources/linode.py", line 88, in <listcomp>
    data = [ _make_linode_row(l) for l in groups[k] ]
  File "/usr/local/lib/python3.6/site-packages/linodecli/resources/linode.py", line 36, in _make_linode_row
    linode.type.storage,
AttributeError: 'NoneType' object has no attribute 'storage'

Running apt upgrade on Ubuntu 20.04 Bionic results in unexpected and disruptive behaviour

Issue:

  • when using ansible to automate system configuration, running apt update results in changed grub settings
A new version (/tmp/grub.m5c6gNlnhk) of configuration file /etc/default/grub is available, but the version   installed currently has been locally modified.   

Now there isn't a way to select to keep the local version currently installed with ansible (at least that I know of). How do we handle this?

Also, how are we supposed to handle this when doing updates unattended?

As you can see a number of people do not know how to resolve/handle this problem. Your feedback is greatly appreciated.

Thanks.

Pipe Detection

It would be nice to be able to pipe output around without needing --raw in the command, and it is possible. Let's make it happen.

depends on enum34, even for python3

I was trying to package linode-cli for NixOS and I noticed a couple issues with the release artifacts. I'll post a separate issues about them.

The wheel archive metadata.json file says that run_requires enum34, but it looks like enum34 is only targeting a sub-set of the python versions this project is targeting. I'm not that familiar with how wheel archive metadata works, but it would be nice if it could be specified that enum34 is only necessary for python2 or whatever.

Warning given to update, but upgrade command doesn't fix it

When running simple commands I get

"The API responded with version 4.0.15, which is newer than the CLI's version of 4.0.11. Please update the CLI to get access to the newest features. You can update with a simple pip install --upgrade linode-cli"

However, running pip install --upgrade linode-cli says I am already up to date.

linode-cli locations --token $LINODE_PAT should work without configure

$ linode-cli locations  --token $LINODE_PAT
Traceback (most recent call last):
  File "/home/marques/.local/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/home/marques/.local/lib/python3.5/site-packages/linodecli/cli.py", line 85, in main
    getattr(obj, cmd)(args, client, unparsed=unparsed)
  File "/home/marques/.local/lib/python3.5/site-packages/linodecli/resources/linode.py", line 358, in locations
    print("{} {}".format(r.id, Color('{green}(Default){/green}') if r.id == args.location else ''))
AttributeError: 'Namespace' object has no attribute 'location'

Further, this should work without configure or --token.. Likewise for similar endpoints.

Cloning onto existing Linode gives error

Command run:

$ linode-cli linodes clone 10692855 --linode_id 10894671
Request failed: 400
┌errors──┬──────────────────────────────────────────────┐
│ field  │ reason                                       │
├────────┼──────────────────────────────────────────────┤
│ type   │ A valid Linode type by that ID was not found │
│ region │ region is not valid                          │
└────────┴──────────────────────────────────────────────┘

stackscript list generates AttributeError: 'MappedObject' object has no attribute 'example'

Traceback (most recent call last):
  File "/usr/local/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/linodecli/cli.py", line 85, in main
    getattr(obj, cmd)(args, client, unparsed=unparsed)
  File "/usr/local/lib/python3.6/site-packages/linodecli/resources/stackscript.py", line 37, in list
    stackscripts = client.linode.get_stackscripts(mine_only=True)
  File "/usr/local/lib/python3.6/site-packages/linode/linode_client.py", line 44, in get_stackscripts
    return self.client._get_and_filter(StackScript, *filters)
  File "/usr/local/lib/python3.6/site-packages/linode/linode_client.py", line 495, in _get_and_filter
    return self._get_objects(obj_type.api_list(), obj_type, filters=parsed_filters)
  File "/usr/local/lib/python3.6/site-packages/linode/linode_client.py", line 410, in _get_objects
    page_url=formatted_endpoint[1:], cls=cls)
  File "/usr/local/lib/python3.6/site-packages/linode/mappings.py", line 34, in make_paginated_list
    l = make_list(json[key], client, parent_id=parent_id, cls=cls)
  File "/usr/local/lib/python3.6/site-packages/linode/mappings.py", line 28, in make_list
    o._populate(obj)
  File "/usr/local/lib/python3.6/site-packages/linode/objects/linode/stackscript.py", line 59, in _populate
    mapped_udfs.append(UserDefinedField(udf.name, udf.label, udf.example, t, \
AttributeError: 'MappedObject' object has no attribute 'example'

Raises when linode.type is None

This can happen rarely. Stack trace looks like this:

Traceback (most recent call last):
  File "/usr/local/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/site-packages/linodecli/cli.py", line 85, in main
    getattr(obj, cmd)(args, client, unparsed=unparsed)
  File "/usr/local/lib/python3.5/site-packages/linodecli/resources/linode.py", line 88, in list
    data = [ _make_linode_row(l) for l in groups[k] ]
  File "/usr/local/lib/python3.5/site-packages/linodecli/resources/linode.py", line 88, in <listcomp>
    data = [ _make_linode_row(l) for l in groups[k] ]
  File "/usr/local/lib/python3.5/site-packages/linodecli/resources/linode.py", line 36, in _make_linode_row
    linode.type.storage,
AttributeError: 'NoneType' object has no attribute 'storage'

Cannot remove domain records with duplicate names.

When I create multiple A records for the same subdomain, I cannot remove any of them again through with cli.

$ linode-cli domain record-create -y A -n "*" -R "192.168.0.1" domain.com
$ linode-cli domain record-create -y A -n "*" -R "192.168.0.2" domain.com
$ linode-cli domain record-create -y A -n "*" -R "192.168.0.3" domain.com
$ linode-cli domain record-delete domain.com A "*"
Ambiguous criteria - found 3 records instead of 1

Reading through the code, it seems that if I do not target only one machine to use the cli in this way, but I can only use the address or the label. While I could use the address in my example, this won't always work as I might have other labels pointing to the address.

Ideally, I would like a --all option to bypass the check to ensure that I've only selected one machine.

Provide a markdown output format

Markdown could be handled in a similar way to the current --text tabbed delimited format.

Tabs would be replaced with |, and the header line would be followed by a line with --- field for each field name (also delimited by |).

k8s-alpha create assumes that public ssh key contains filename

Note: This error is only reproduced on mac.

The k8s-alpha plugin assumes that the public ssh key contains the filename, which I guess is not stable across different OS implementations. On mac, the default comment user@hostname, which does not match the key filename which the script checks for. As a result, the create command generates the warning "Your ssh private key must be added to your ssh-agent." even if you have added the key. The workaround I used was to generate a key that the script accepted was

> ssh-keygen -b 4096 -t rsa -C "id_rsa"`
> ssh-add -K ~/.ssh/id_rsa
> linode-cli k8s-alpha create k8s --ssh-public-key ~/.ssh/id_rsa.pub

See Generating a new SSH key and adding it to the ssh-agent

linode-cli k8s-alpha create should prevalidate cluster names

Using the label: k8s_test, for example, will result in a nearly completed cluster and a very late error.

module.k8s.linode_instance.k8s_master (remote-exec): name: Invalid value: "k8s_test-master-1": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

`linodes backups-list` outputs malformed table and JSON

Making the following request:

$ linode-cli linodes backups-list 11562279
Results in the following output:

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬─────────────┬─────────┐
│ automatic │ in_progress │ current │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────┼─────────┤
│ {'id': 108191249, 'disks': [{'size': 2669, 'label': 'Arch Linux Disk', 'filesystem': 'ext4'}, {'size': 0, 'label': '512 MB Swap Image', 'filesystem': 'swap'}], 'region': 'us-central', 'type': 'auto', 'configs': ['My Arch Linux Disk Profile'], 'label': None, 'status': 'successful', 'updated': '2018-12-28T15:52:09', 'finished': '2018-12-28T15:44:10', 'created': '2018-12-28T15:37:06'}, {'id': 107853153, 'disks': [{'size': 2567, 'label': 'Arch Linux Disk', 'filesystem': 'ext4'}, {'size': 0, 'label': '512 MB Swap Image', 'filesystem': 'swap'}], 'region': 'us-central', 'type': 'auto', 'configs': ['My Arch Linux Disk Profile'], 'label': None, 'status': 'successful', 'updated': '2018-12-28T15:52:09', 'finished': '2018-12-23T16:11:16', 'created': '2018-12-23T16:03:54'}, {'id': 107379900, 'disks': [{'size': 2459, 'label': 'Arch Linux Disk', 'filesystem': 'ext4'}, {'size': 0, 'label': '512 MB Swap Image', 'filesystem': 'swap'}], 'region': 'us-central', 'type': 'auto', 'configs': ['My Arch Linux Disk Profile'], 'label': None, 'status': 'successful', 'updated': '2018-12-28T15:52:10', 'finished': '2018-12-16T15:50:40', 'created': '2018-12-16T15:41:50'} │ │ │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴─────────────┴─────────┘
bellis@Benjamins-MacBook-Pro:~/dev/linode-cli

`event list` fails with index out of range error

$ linode-cli event list                                                                                                                                                                                                                                                                                                                            [ruby-2.5.0p0]
Traceback (most recent call last):
  File "/usr/local/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/linodecli/cli.py", line 85, in main
    getattr(obj, cmd)(args, client, unparsed=unparsed)
  File "/usr/local/lib/python3.6/site-packages/linodecli/resources/events.py", line 44, in list
    for e in events[:10]:
  File "/usr/local/lib/python3.6/site-packages/linode/paginated_list.py", line 49, in __getitem__
    return self._get_slice(index)
  File "/usr/local/lib/python3.6/site-packages/linode/paginated_list.py", line 98, in _get_slice
    result.append(self[c])
  File "/usr/local/lib/python3.6/site-packages/linode/paginated_list.py", line 58, in __getitem__
    raise IndexError('list index out of range')
IndexError: list index out of range

list, start, and stop work fine.

linode-domain record-create parsing issue

When a TXT record value starts with a minus/hyphen char, the linode-domain cli tool reports a parsing error. The behavior is the same when tested with double or single quotes. Issuing the same command without the leading minus/hyphen char works as expected.

Creating record with the following command:

linode-cli domains records-create 459068 --type TXT  --name _acme-challenge --target -xrOw1XWVekOhIbtSMfrFkce4Cgf5jczfKqZqD6H05I
linode-cli: error: argument --target: expected one argument

Unable to install certbot after installing linode-cli with pip

Hello,

I stumbled on issues with installation of certbot after installing linode-cli with pip. As I had this on an Ansible generated server after I added:

- name: Install Python packages
  pip:
    name: "{{item}}"
    state: present
  with_items:
    - linode-cli

Error with yum install certbot

Error unpacking rpm package python-urllib3-1.10.2-5.el7.noarch

Not sure how or where this should be resolved.. Please also check certbot/certbot#6245.

Grtz

Willem

Add --suppress-warnings flag

Some users have experienced problems with scripts when the "Upgrade" warning appeared following a new API release. This can be especially frustrating if the CLI update is not immediately available (they're usually close, but not timed exactly the same). A flag to suppress this warning should help alleviate these issues.

Creating a new Linode reveals a 400 error (CoreOS only?)

$ linode-cli create  -l testlinode2 -P $PASSWORD -d linode/containerlinux -L us-east-1a -p g5-nanode-1 --token $LINODE_PAT
Error: 400: Linode busy.;

$ linode-cli list | grep  testlinode2
:testlinode2:creating:us-east-1a:False:20480:1024

Show warning when using default values

More than one person has been confused when trying to create an empty linode or disk and being prompted for a root password. This behavior comes from the default usage of "image" from the config in requests where it is relevant. While this behavior is often desirable, it can be confusing.

Add a warning that mentions the default usage and it's value, and how to disable defaults.

`make build` fails: cp: cannot stat 'data-2': No such file or directory

On the current master (b49c630) I get this on make build:

rm -f linodecli/data-*                                                                                                                                       
rm -f linode-cli.sh                                                                                                                                          
rm -f dist/*                                                                                                                                                 
python -m linodecli bake https://developers.linode.com/api/v4/openapi.yaml --skip-config                                                                     
No spec baked.  Please bake by calling this script as follows:                                                                                               
  python3 gen_cli.py bake /path/to/spec                                                                                                                      
Baking...                                                                                                                                                    
Warning: Resolved empty node for {'type': 'object'} in [{'$ref': '#/components/schemas/IPAddress'}, {'type': 'object'}]                                      
Baking bash completions...                                                                                                                                   
Writing file...                                                                                                                                              
Done.                                                                                                                                                        
python3 -m linodecli bake https://developers.linode.com/api/v4/openapi.yaml --skip-config                                                                    
No spec baked.  Please bake by calling this script as follows:                                                                                               
  python3 gen_cli.py bake /path/to/spec                                                                                                                      
Baking...                                                                                                                                                    
Warning: Resolved empty node for {'type': 'object'} in [{'$ref': '#/components/schemas/IPAddress'}, {'type': 'object'}]                                      
Baking bash completions...                                                                                                                                   
Writing file...                                                                                                                                              
Done.                                                                                                                                                        
cp data-2 linodecli/                                                                                                                                         
cp: cannot stat 'data-2': No such file or directory                                                                                                          
make: *** [Makefile:23: build] Error 1    

asciicast

"Image is not valid" when creating Linode from backup

I try to create a Linode with the following command:

linode-cli linodes create --type g6-standard-4 --region eu-central --backup_id 103216265 --backups_enabled false --private_ip true --group SmoothcompNew

Result:

Request failed: 400
┌errors─┬────────────────────┐
│ field │ reason             │
├───────┼────────────────────┤
│ image │ image is not valid │
└───────┴────────────────────┘

I have verified that the backup is in the same region. It does not matter whether the backup is a manual or automatic snapshot.

Nodebalancer config_update has poor argument defaults(ie any)

The defaults for config_update appear to have been copied from config_create

parser.add_argument('-L', '--protocol', metavar='PROTOCOL', type=str, default='http',
help="One of 'tcp', 'http', and 'https'")
parser.add_argument('-A', '--algorithm', metavar='ALGORITHM', type=str, default='roundrobin',
help="Balancing algorithm. Options are 'roundrobin', 'leastconn', and 'source'")
parser.add_argument('-S', '--stickiness', metavar='STICKINESS', type=str, default='table',
help="Session persistence. One of 'none', 'table', 'http_cookie'")
parser.add_argument('-H', '--check-health', metavar='CHECKHEALTH', type=str, default='connection',
help="Perform active health checks on the backend nodes. One of 'connection', 'http', or 'http_body'")
parser.add_argument('-I', '--check-interval', metavar="CHECKINTERVAL", type=int, default=5,
help="Seconds between health check probes (2-3600)")
parser.add_argument('-T', '--check-timeout', metavar='CHECKTIMEOUT', type=int, default=3,
help="Seconds to wait before considering the probe a failure (1-30)")
parser.add_argument('-X', '--check-attempts', metavar='CHECKATTEMPTS', type=int, default=2,

It is fairly unexpected that updating your SSL cert causes the protocol to be switched to http without prompting if you do not explicitly add an argument

ticket show renders poorly

Ticket and reply bodies need to be wrapped to not exceed terminal width. Current behavior is very difficult to read and bad.

Using nodebalancers config-update

When attempting to use the rewritten CLI, there doesn't appear to be any documentation on what the SSL cert & key arguments should look like.

linode-cli nodebalancers config-update 123 123 --port 443 --ssl_cert /etc/letsencrypt/live/forums.spacebattles.com/fullchain.pem --ssl_key /etc/letsencrypt/live/forums.spacebattles.com/privkey.pem

Returns:

lerrorsqqqqwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x field    x reason                                              x
tqqqqqqqqqqnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
x ssl_key  x SSL private key appears to be incorrectly formatted x
x ssl_cert x SSL certificate appears to be incorrectly formatted x
mqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Relationship between linode_api4-python

Hi there. Thanks for this project.

I'm wondering about what is the relationship between https://github.com/linode/linode_api4-python and this project since I can't see this project pulls in the api4-python project. This project seems to roll all of it's own logic for requesting the API, is that correct? I know the api4-python projec is beta right now however ...

I'm asking since I am in the process of building automation for Linode with Ansible (see ansible/ansible#45406) and want to pick where I should point my upstream contributions. I assume https://github.com/linode/linode_api4-python for that?

BTW, this library is pretty interesting, in that, I can't really find any logic which is actually doing anything here. It's all just a wrapper for forwarding OpenAPI client commands? Is this the case? Pretty cool ...

Provide an option to paginate through all pages

Provide an option to paginate through all pages.

An option like --all-pages would be helpful and prevent workflows like this:

(
linode-cli --text kernels list --page=100
for p in {1..3}; do
  linode-cli --no-headers --text  kernels list --page $p
done
)

Use $XDG_CONFIG_HOME for config files

I think it'd be better if linode-cli respected the $XDG_CONFIG_HOME variable and defaulted to $HOME/.config/linode-cli as the config dir if it's not set.

Personally, I don't like my home directory getting cluttered and this variable seems to be the standard for newer software unix-y systems.

Related package: https://pypi.org/project/xdg/

It's fairly small, just checks the env variables and has sane defaults if the variables are not set.

Reference: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Unable to view usernames

Bug Description
Unable to view linode users via the CLI. The linode-cli users view --username $USERNAME command fails to accept valid username arguments.

Steps to Reproduce

linode-cli users view --username $(linode-cli users list --text --no-headers --format username | head -n 1)

usage: linode-cli [-h] [--username username] username_
linode-cli: error: too few arguments

Tag missing for 2.0.7

According to PyPI, the current version of this package is 2.0.7, but there is no corresponding tag on GitHub. Could you please tag this version on GitHub?

make install failed on Ubuntu 17.10

using master or latest 2.x tag

mzd☯ artichoke :>sudo make install SPEC=https://developers.linode.com/openapi.yaml
python linodecli bake https://developers.linode.com/openapi.yaml --skip-config
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/share/linode-cli/linodecli/__main__.py", line 3, in <module>
    from linodecli import main
ImportError: No module named linodecli
Makefile:20: fallo en las instrucciones para el objetivo 'common'
make: *** [common] Error 1

Missing license.

I can't find any reference to a license at all for this project, is it GPL2 like the previous version or is it something else?

Adding a LICENSE file to the repo would be much appreciated - I've packaged this for Arch but the lack of a license is holding me back on publishing it for the time being.

linode-cli create fails when specifying a distribution

Receiving Error: 400: distribution is not valid; when trying to create a Linode and specifying a distribution:

$ linode-cli create --label test --distribution 'CoreOS Container Linux'
Root Password:
Error: 400: distribution is not valid;

$ linode-cli create --label test --distribution '157'
Root Password:
Error: 400: distribution is not valid;

$ linode-cli create --label test -d 157
Root Password:
Error: 400: distribution is not valid;

$ linode-cli create --label test -d 15
Root Password:
Error: 400: distribution is not valid;

linode-cli fails to create a linode with a label

Attempting to create a linode per the example in the readme fails.

linode-cli linodes create --type g5-standard-2 --region us-east --image linode/debian9 --label cli-1 --root_pass hunter7

linode-cli: error: unrecognized arguments: --label cli-1

It seems support for the --label argument was never added

linode-cli linodes create fails with AttributeError: CLIArg instance has no attribute 'required'

~ $ linode-cli linodes create --help
linode-cli linodes create
Create Linode

Arguments:
Traceback (most recent call last):
  File "/usr/local/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/linodecli/__init__.py", line 193, in main
    for arg in sorted(operation.args, key=lambda s: not s.required):
  File "/usr/local/lib/python2.7/dist-packages/linodecli/__init__.py", line 193, in <lambda>
    for arg in sorted(operation.args, key=lambda s: not s.required):
AttributeError: CLIArg instance has no attribute 'required'

I'm on Ubuntu 18.04, Pythin 2.7 as can be seen, linode-cli installed with pip.

root_pass is required, but not marked as such

As of linode-cli 2.0.12 (Built off spec version 4.0.9) the inline documentation for create does not indicate that root_pass is required.

$ linode-cli linodes create --help
linode-cli linodes create
Create Linode

Arguments:
  --region: (required) The [Region](#operation/getRegions) where the Linode will be located.
  --type: (required) The [Linode Type](#operation/getLinodeTypes) of the Linode you are creating.
  --root_pass: The password for the root user on the newly-created Linode.
<snip>

Yet if I try to create a linode without specifying a root_pass it fails.

linode-cli linodes create --type g6-standard-4
Request failed: 400
┌errors─────┬───────────────────────┐
│ field     │ reason                │
├───────────┼───────────────────────┤
│ root_pass │ root_pass is required │
└───────────┴───────────────────────┘

I know this is a minor documentation issue, but I like consistency. :)

This may not be something that can be changed in this repository, looks like it may be coming from the API spec: https://developers.linode.com/api/v4#operation/createLinodeInstance (see "Request Body Schema").

Perhaps this is a feature? Are there situations where root_pass is not required in order to successfully create a linode?

Create global status command

Write a command that retrieves Linode's global status from status.linode.com and parses it into a command-line friendly version.

Allow to save the token someplace else

Hello

thanks for this tool, however I have a request to make, please allow me to save the token someplace else than unencrypted in the configuration file.

I'd be great if the token can be taken from a commands' output in the config file

tokenCmd = ~/bin/show-my-linode-token.sh

Or as an environmental variable (LINODE_TOKEN=xxxx)

Or as a parameter (--token=XXX), this way has the disadvantage of revealing the token to other users doing ps on the same machine.

I really dislike having a plain text password in my hard drive, thanks!

Error message on command input not helpful

I have been trying to use the cli to manage nodes, but I keep running into some command weirdness. Commands like list work as expected:

linode-cli --token ******* list --raw
abc:abc_web_1234567:running:us-west-1a:False:20480:1024
abc:abc_db_1234567:running:us-west-1a:False:20480:1024

But commands like distros act error out:

linode-cli --token ******* distros
Traceback (most recent call last):
  File "/usr/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.6/site-packages/linodecli/cli.py", line 85, in main
    getattr(obj, cmd)(args, client, unparsed=unparsed)
  File "/usr/lib/python3.6/site-packages/linodecli/resources/linode.py", line 372, in distros
    print("{} {}".format(d.label, Color('{green}(Default){/green}') if d.id == args.distribution else ''))
AttributeError: 'Namespace' object has no attribute 'distribution'

I tried this in an Alpine container, a macOS system, and an Arch Linux system with the same results each time.

Furthermore, when you specify a type, it always seems to default to the linode type:

linode-cli --token ******* linode distros
Command not found - options are: backups-cancel, backups-enable, backups-restore, backups-show, create, delete, distros, group, ip-add, list, locations, plans, rebuild, rename, resize, restart, show, snapshot, start, stop

linode-cli --token ******* event list    
Command not found - options are: backups-cancel, backups-enable, backups-restore, backups-show, create, delete, distros, group, ip-add, list, locations, plans, rebuild, rename, resize, restart, show, snapshot, start, stop

Is this user error? A gap in the docs? A missing dependency? I'm grasping at straws here.

Provide linode-cli in the Linode APT repository

The deprecated github.com/linode/cli project was available through Linode's APT repository.

This issue is a place-holder for any decision to include or exclude linode-cli in the Linode APT repository.

Feature Request: manage account IP white lists

Hi there, we're a company using Linode and working in many different locations and therefore have a lot of white listed IPs on our account. Some of those do not have a note and we are thinking about implementing a process whereby non-noted white listed IPs for the account get wiped each day.

As far as I can see, it is not possible to access the IP white list from the existing version of this tool.

In fact, after some looking, it is not available on the API either?

https://developers.linode.com/api/v4

Where could I go about getting this feature request seen to if not here?

Thanks.

Volume mount instructions should print to console when attaching block storage

Would be nice if linode-cli volume create example-volume -l example-linode -s 20

prints the information from the manager

To get started with a new volume, you'll want to create a filesystem on it:

mkfs.ext4 "/dev/disk/by-id/scsi-0Linode_Volume_example-volume"

Once the volume has a filesystem, you can create a mountpoint for it:
...

ip-add fails when accessing CLIArg.path

Executing linode-cli linode ip-add fails with the following traceback.

asauber@linaret manager # linode-cli linodes ip-add
Traceback (most recent call last):
  File "/usr/local/bin/linode-cli", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/linodecli/__init__.py", line 209, in main
    cli.handle_command(parsed.command, parsed.action, args)
  File "/Library/Python/2.7/site-packages/linodecli/cli.py", line 413, in handle_command
    result = self.do_request(operation, args)
  File "/Library/Python/2.7/site-packages/linodecli/cli.py", line 323, in do_request
    parsed_args = operation.parse_args(args)
  File "/Library/Python/2.7/site-packages/linodecli/operation.py", line 111, in parse_args
    print(arg.path)
AttributeError: CLIArg instance has no attribute 'path'

With a bit of debugging, it was found that the offending CLIArg was type, which did have a name and description, but no path.

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.