pve-client.git
14 months agopveclient: add read_pasword handler
Dietmar Maurer [Thu, 14 Jun 2018 10:14:58 +0000 (12:14 +0200)]
pveclient: add read_pasword handler

Because this is the base CLIHandler class now.

14 months agorename defaut output format from 'table' to 'text'
Dietmar Maurer [Thu, 14 Jun 2018 09:57:40 +0000 (11:57 +0200)]
rename defaut output format from 'table' to 'text'

14 months agoadd new helper print_result
Dietmar Maurer [Thu, 14 Jun 2018 09:12:29 +0000 (11:12 +0200)]
add new helper print_result

14 months agofully implement api get/set/create/delete
Dietmar Maurer [Thu, 14 Jun 2018 08:18:10 +0000 (10:18 +0200)]
fully implement api get/set/create/delete

14 months agoConfig.pm: use PVE::APIClient::PTY
Dietmar Maurer [Thu, 14 Jun 2018 08:08:06 +0000 (10:08 +0200)]
Config.pm: use PVE::APIClient::PTY

14 months agoregister stanadard option 'pveclient-output-format'
Dietmar Maurer [Thu, 14 Jun 2018 07:36:54 +0000 (09:36 +0200)]
register stanadard option 'pveclient-output-format'

14 months agolist.pm: add missing use clauses
Dietmar Maurer [Thu, 14 Jun 2018 07:31:53 +0000 (09:31 +0200)]
list.pm: add missing use clauses

14 months agoimplement call_method
Dietmar Maurer [Thu, 14 Jun 2018 06:16:31 +0000 (08:16 +0200)]
implement call_method

14 months agoupdate files from pve-common
Dietmar Maurer [Thu, 14 Jun 2018 07:13:50 +0000 (09:13 +0200)]
update files from pve-common

Includes some changes which are still not applied.

14 months agouse packages from PVE::APIClient
Dietmar Maurer [Thu, 14 Jun 2018 06:54:17 +0000 (08:54 +0200)]
use packages from PVE::APIClient

14 months agoMakefile: cleanup - use a loop to install files
Dietmar Maurer [Wed, 13 Jun 2018 11:42:28 +0000 (13:42 +0200)]
Makefile: cleanup - use a loop to install files

14 months agoAdd update-pve-common make target to move code to PVE/APIClient.
René Jochum [Wed, 13 Jun 2018 10:04:17 +0000 (12:04 +0200)]
Add update-pve-common make target to move code to PVE/APIClient.

14 months agoAdd spice command
René Jochum [Wed, 13 Jun 2018 08:44:59 +0000 (10:44 +0200)]
Add spice command

14 months agoinstall missing files
Dietmar Maurer [Wed, 13 Jun 2018 08:15:52 +0000 (10:15 +0200)]
install missing files

14 months agorename start.pm to GuestStatus.pm, implement stop command
Dietmar Maurer [Wed, 13 Jun 2018 07:24:37 +0000 (09:24 +0200)]
rename start.pm to GuestStatus.pm, implement stop command

Please note that we group similar commands inside a single command class.
Our CLIHandler then nicely groups this commands inside help.

14 months agoremove PVE/APIClient/Commands/help.pm
Dietmar Maurer [Wed, 13 Jun 2018 06:57:53 +0000 (08:57 +0200)]
remove PVE/APIClient/Commands/help.pm

not needed anymore.

14 months agoAdd start command
René Jochum [Tue, 12 Jun 2018 11:49:01 +0000 (13:49 +0200)]
Add start command

I've added the logic to poll the task given by status/start until its
"stopped", this enables an usage like:

pveclient lxc create 999 && pveclient start 999 && pveclient enter 999

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agoUse get_standard_option for vmid in enter
René Jochum [Tue, 12 Jun 2018 09:55:03 +0000 (11:55 +0200)]
Use get_standard_option for vmid in enter

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agogenerate_usage_str: do no generate help for unknown commands
Dietmar Maurer [Wed, 13 Jun 2018 05:54:33 +0000 (07:54 +0200)]
generate_usage_str: do no generate help for unknown commands

Before:

...
USAGE: pvesm aaa zfsscan

With this patch applied:

no such command 'aaa'

14 months agocleanup: use nested CLIHandler command definitions
Dietmar Maurer [Wed, 13 Jun 2018 05:25:56 +0000 (07:25 +0200)]
cleanup: use nested CLIHandler command definitions

14 months agoupdate copy of PVE/JSONSchema.pm
Dietmar Maurer [Wed, 13 Jun 2018 06:06:03 +0000 (08:06 +0200)]
update copy of PVE/JSONSchema.pm

14 months agoadd missing file PVE/APIClient/Commands/config.pm
Dietmar Maurer [Tue, 12 Jun 2018 10:06:46 +0000 (12:06 +0200)]
add missing file PVE/APIClient/Commands/config.pm

14 months agoConfig.pm: add new defaults sections
Dietmar Maurer [Tue, 12 Jun 2018 04:21:56 +0000 (06:21 +0200)]
Config.pm: add new defaults sections

And implement a new command to setup defaults.

14 months agouse binary format to store API definition efficently
Dietmar Maurer [Fri, 8 Jun 2018 13:47:10 +0000 (15:47 +0200)]
use binary format to store API definition efficently

Note: The previous file does not contains indexed parameters like -net\d+ (those
were converted to to -net[n]). But we need all those parameters for the command
line completion. The binary format is much smaller the json, because it can handle
references.

14 months agofix bash completion for simple command classes like 'list'.
Dietmar Maurer [Tue, 12 Jun 2018 06:07:50 +0000 (08:07 +0200)]
fix bash completion for simple command classes like 'list'.

14 months agoimplement bash completion for get/set/create/delete
Dietmar Maurer [Thu, 7 Jun 2018 11:34:11 +0000 (13:34 +0200)]
implement bash completion for get/set/create/delete

14 months agoadd more helper for bash completion
Dietmar Maurer [Thu, 7 Jun 2018 11:33:12 +0000 (13:33 +0200)]
add more helper for bash completion

14 months agoAdd a simple implementation of list
René Jochum [Mon, 11 Jun 2018 09:35:27 +0000 (11:35 +0200)]
Add a simple implementation of list

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agolxc enter: improve escape key handling
Wolfgang Bumiller [Mon, 11 Jun 2018 09:30:38 +0000 (11:30 +0200)]
lxc enter: improve escape key handling

The escape key should not be passed through, this now only
happens when pressing the escape key twice (as it is with
tmux, screen, ssh, etc.).
Also prepared the code to handle a configurable escape key,
and restructured the handling to more easily allow adding
more keys. For instance we could add shortcuts for some
`pct` commands. Most of them are marginally useful, but
snapshot, migrate, shutdown or stop might still be
nice-to-have things.
The idea is also that if we reuse the code for serial
terminals for VMs we can add shortcuts to eg. paste the
current terminal size (probably the most useful one), or
to send sys-rqs or agent commands.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agoconfig: typo fixup
Wolfgang Bumiller [Mon, 11 Jun 2018 09:30:36 +0000 (11:30 +0200)]
config: typo fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
14 months agolxc enter: set STDOUT to non-blocking mode
Dietmar Maurer [Fri, 8 Jun 2018 08:51:22 +0000 (10:51 +0200)]
lxc enter: set STDOUT to non-blocking mode

14 months agolxc enter: fix read from non-blocking web socket
Dietmar Maurer [Fri, 8 Jun 2018 08:20:21 +0000 (10:20 +0200)]
lxc enter: fix read from non-blocking web socket

14 months agolxc enter: switch back to non-blocking mode
Dietmar Maurer [Fri, 8 Jun 2018 07:57:09 +0000 (09:57 +0200)]
lxc enter: switch back to non-blocking mode

regression was introcude in patch e9d848651dd50d169a532d4428f47b0754e5ac9

14 months agolxc enter: cleanup filehandle usage
Dietmar Maurer [Fri, 8 Jun 2018 07:48:17 +0000 (09:48 +0200)]
lxc enter: cleanup filehandle usage

14 months agolxc console: limit output buffer size
Dietmar Maurer [Fri, 8 Jun 2018 06:48:07 +0000 (08:48 +0200)]
lxc console: limit output buffer size

14 months agolxc enter: handle writes with select
Dietmar Maurer [Fri, 8 Jun 2018 06:02:13 +0000 (08:02 +0200)]
lxc enter: handle writes with select

14 months agolxc enter: use IO::Select->select
Dietmar Maurer [Fri, 8 Jun 2018 05:06:37 +0000 (07:06 +0200)]
lxc enter: use IO::Select->select

14 months agoCLIHandler: copied updates from pve-common
Dietmar Maurer [Fri, 8 Jun 2018 04:36:47 +0000 (06:36 +0200)]
CLIHandler: copied updates from pve-common

14 months agoPoll the size of the terminal and resize if needed
René Jochum [Thu, 7 Jun 2018 12:29:26 +0000 (14:29 +0200)]
Poll the size of the terminal and resize if needed

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agoimplemet and use full_write()
Dietmar Maurer [Thu, 7 Jun 2018 09:28:10 +0000 (11:28 +0200)]
implemet and use full_write()

14 months agowebsocket: set max_payload_size to 128*1024
Dietmar Maurer [Thu, 7 Jun 2018 04:44:21 +0000 (06:44 +0200)]
websocket: set max_payload_size to 128*1024

Because our server sends larger frames up to 128KB.

14 months agolxc enter: simplify code and cleanups
Dietmar Maurer [Wed, 6 Jun 2018 09:30:13 +0000 (11:30 +0200)]
lxc enter: simplify code and cleanups

- print error messages after reseting the terminal
- catch signals

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
14 months agoparse_web_socket_frame: use $wsbuf_ref directly, so that we really consume data
Dietmar Maurer [Wed, 6 Jun 2018 09:30:12 +0000 (11:30 +0200)]
parse_web_socket_frame: use $wsbuf_ref directly, so that we really consume data

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
14 months agofixup for previous commit: really set blocking mode
Dietmar Maurer [Wed, 6 Jun 2018 06:24:57 +0000 (08:24 +0200)]
fixup for previous commit: really set blocking mode

14 months agoenter: on exit, switch back to blocking mode
Dietmar Maurer [Wed, 6 Jun 2018 05:46:26 +0000 (07:46 +0200)]
enter: on exit, switch back to blocking mode

Else later shell commands will fail!

14 months agoallow to setup remotes without password
Dietmar Maurer [Wed, 6 Jun 2018 05:02:36 +0000 (07:02 +0200)]
allow to setup remotes without password

And query the password on demand.

14 months agoremote add: fix connection setup
Dietmar Maurer [Wed, 6 Jun 2018 04:59:14 +0000 (06:59 +0200)]
remote add: fix connection setup

14 months agoJSONSchema: fix getopt when invoking without arguments
Dietmar Maurer [Wed, 6 Jun 2018 04:37:22 +0000 (06:37 +0200)]
JSONSchema: fix getopt when invoking without arguments

14 months agoAdd "lxc enter" from "pventer" without its deps.
René Jochum [Tue, 5 Jun 2018 16:03:42 +0000 (18:03 +0200)]
Add "lxc enter" from "pventer" without its deps.

This patch adds the functionality of "pventer" to "pveclient" without
its external dependecies, we solved them with our internal tools.

I tried to use IO::Select->select() but failed hard with it, so i
switched back to $select->can_(read|write).

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agoFix the WebSocket client to work with none PVE servers.
René Jochum [Tue, 5 Jun 2018 16:03:41 +0000 (18:03 +0200)]
Fix the WebSocket client to work with none PVE servers.

For debugging I tested the WebSocket client with my Protocol::WebSocket
server (i have hexdumps in it), this patch is required to make it work
with it. I'm pretty sure we need it for Proxies too.

14 months agoRemove the File::HomeDir requirement
Dietmar Maurer [Tue, 5 Jun 2018 10:06:31 +0000 (12:06 +0200)]
Remove the File::HomeDir requirement

Simply use $ENV{HOME} instead.

14 months agouse SectionConfig for PVE::APIClient::Config
Dietmar Maurer [Tue, 5 Jun 2018 09:44:45 +0000 (11:44 +0200)]
use SectionConfig for PVE::APIClient::Config

14 months agohelp.pm: fix generate usage string (hide password option)
Dietmar Maurer [Tue, 5 Jun 2018 08:37:41 +0000 (10:37 +0200)]
help.pm: fix generate usage string (hide password option)

14 months agoadd PVE::Tools::extract_param helper
Dietmar Maurer [Tue, 5 Jun 2018 07:33:43 +0000 (09:33 +0200)]
add PVE::Tools::extract_param helper

14 months agoregister standard option inside PVE::APIClient::Config
Dietmar Maurer [Tue, 5 Jun 2018 06:03:57 +0000 (08:03 +0200)]
register standard option inside PVE::APIClient::Config

14 months agoimported SectionConfig from pve-common
Dietmar Maurer [Tue, 5 Jun 2018 05:51:00 +0000 (07:51 +0200)]
imported SectionConfig from pve-common

14 months agoremove useless comments
Dietmar Maurer [Tue, 5 Jun 2018 05:41:34 +0000 (07:41 +0200)]
remove useless comments

14 months agoImplement remote remove
René Jochum [Mon, 4 Jun 2018 14:49:05 +0000 (16:49 +0200)]
Implement remote remove

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agoAdd a basic implementation of remote list
René Jochum [Mon, 4 Jun 2018 14:49:04 +0000 (16:49 +0200)]
Add a basic implementation of remote list

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agoImplement remote add
René Jochum [Mon, 4 Jun 2018 14:49:03 +0000 (16:49 +0200)]
Implement remote add

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agoAdd config class.
René Jochum [Mon, 4 Jun 2018 14:49:02 +0000 (16:49 +0200)]
Add config class.

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agoimplement help
Dietmar Maurer [Mon, 4 Jun 2018 08:41:41 +0000 (10:41 +0200)]
implement help

14 months agoinclude PVE/PTY.pm (copied from pve-common)
Dietmar Maurer [Mon, 4 Jun 2018 06:28:31 +0000 (08:28 +0200)]
include PVE/PTY.pm (copied from pve-common)

14 months agoAdd .gitignore
René Jochum [Wed, 30 May 2018 12:18:31 +0000 (14:18 +0200)]
Add .gitignore

Signed-off-by: René Jochum <r.jochum@proxmox.com>
14 months agocorrectly use HTTP::Response
Dietmar Maurer [Wed, 30 May 2018 09:28:18 +0000 (11:28 +0200)]
correctly use HTTP::Response

14 months agoremove generic websocket code - not worth to share
Dietmar Maurer [Wed, 30 May 2018 08:40:06 +0000 (10:40 +0200)]
remove generic websocket code - not worth to share

14 months agoimplement basic websocket protocol
Dietmar Maurer [Wed, 30 May 2018 08:35:27 +0000 (10:35 +0200)]
implement basic websocket protocol

14 months agoinstall missing file PVE/APIClient/Config.pm
Dietmar Maurer [Tue, 29 May 2018 09:45:10 +0000 (11:45 +0200)]
install missing file PVE/APIClient/Config.pm

14 months agomove config related code to PVE/APIClient/Config.pm
Dietmar Maurer [Tue, 29 May 2018 07:33:05 +0000 (09:33 +0200)]
move config related code to PVE/APIClient/Config.pm

14 months agouse new PVE::APIClient::Config class, register_standard_option 'pveclient-remote...
Dietmar Maurer [Tue, 29 May 2018 07:20:25 +0000 (09:20 +0200)]
use new PVE::APIClient::Config class, register_standard_option 'pveclient-remote-name'

and implement command line completion for 'remote' names.

14 months agoPVE/APIClient/Config.pm: new class to handle configuration file
Dietmar Maurer [Tue, 29 May 2018 07:18:26 +0000 (09:18 +0200)]
PVE/APIClient/Config.pm: new class to handle configuration file

14 months agolxc.pm: add test code to read config from ~/.pveclient
Dietmar Maurer [Tue, 29 May 2018 06:32:39 +0000 (08:32 +0200)]
lxc.pm: add test code to read config from ~/.pveclient

15 months agoadd code to print perl package dependencies
Dietmar Maurer [Thu, 24 May 2018 11:58:50 +0000 (13:58 +0200)]
add code to print perl package dependencies

We want to minimize that list ...

15 months agoimprove bash completion
Dietmar Maurer [Thu, 24 May 2018 11:28:28 +0000 (13:28 +0200)]
improve bash completion

15 months agoadd split_args helper
Dietmar Maurer [Thu, 24 May 2018 09:06:15 +0000 (11:06 +0200)]
add split_args helper

15 months agouse correct name for bash completion file
Dietmar Maurer [Thu, 24 May 2018 08:55:35 +0000 (10:55 +0200)]
use correct name for bash completion file

15 months agoadd simple bash completion code
Dietmar Maurer [Thu, 24 May 2018 08:26:29 +0000 (10:26 +0200)]
add simple bash completion code

15 months agoadd stub for lxc commands
Dietmar Maurer [Wed, 23 May 2018 10:19:34 +0000 (12:19 +0200)]
add stub for lxc commands

15 months agoimprove usage text
Dietmar Maurer [Wed, 23 May 2018 09:56:40 +0000 (11:56 +0200)]
improve usage text

15 months agouse get_options from PVE::JSONSchema
Dietmar Maurer [Wed, 23 May 2018 08:57:34 +0000 (10:57 +0200)]
use get_options from PVE::JSONSchema

15 months agocopy and use files from pve-common packages
Dietmar Maurer [Wed, 23 May 2018 08:53:55 +0000 (10:53 +0200)]
copy and use files from pve-common packages

We don't want to depend on pve-common, so we simply copy used files.

15 months agocomment out upload target
Dietmar Maurer [Tue, 22 May 2018 12:20:55 +0000 (14:20 +0200)]
comment out upload target

this is experimental code

15 months agoadd debian package files
Dietmar Maurer [Tue, 22 May 2018 12:19:53 +0000 (14:19 +0200)]
add debian package files

15 months agoadd Makefile
Dietmar Maurer [Tue, 22 May 2018 12:14:56 +0000 (14:14 +0200)]
add Makefile

15 months agoadd API definition
Dietmar Maurer [Tue, 22 May 2018 12:11:05 +0000 (14:11 +0200)]
add API definition

15 months agoadd client skeleton
Dietmar Maurer [Tue, 22 May 2018 12:03:28 +0000 (14:03 +0200)]
add client skeleton