Age | Commit message (Collapse) | Author | Files |
|
Document the rex group command.
|
|
|
|
(the 'group' command is not yet documented)
|
|
rex group swap - swap two stack entries
rex group drop - drop a stack entry
The command rex group show takes new options: -a,-all, to
show all stack entries, and -H,--hosts, to show hosts along
with the host group name. The options are mutually exclusive.
|
|
* rex: Clear config(default,selected) in ::hostproc::prologue,
after it has been properly initialized and its content copied
to config(hosts).
|
|
Selected hosts and host groups are kept on a stack. The host group
on top of the stack is the current one. The 'rex group' command is
provided to maintain the host group stack. It takes four subcommands:
git push NAME push current group selection on stack and
select NAME as a new host group
git pop pop current hostgroup selection off stack
git show display the currently selected host group
(and, optionally, hosts in it)
git select COMMAND create a temporary unnamed hostgroup from
hosts on which COMMAND exits with 0 status
and push it on stack
|
|
|
|
* rex (config::hostname): New function.
* rex.man8: Document it.
|
|
Prefix unrecognized messages obtained in the INIT state with "ssh HOSTNAME".
Fix behavior of --ignore-hosts with legacy configuration.
|
|
|
|
* rex (::getopt::parse): Initialize group_id and group_def
Don't use dict lappend
(add_host_key_list): Catch eventual errors
(rex_command,rex_copy_to,rex_list): Move --ignore-hosts to group
global
|
|
|
|
|
|
|
|
|
|
Restore priority of command-line settings over the rc
* rex (version): Raise to 3.91
(optiondef): New global array.
(throw_config_error)
(catch_config_error): New functions.
(option_set): New function.
(::getopt::parse): Rewrite. Instead of taking option groups as positional
arguments, accept the -group option which defines an option group. It takes
two arguments: group ID and a list of group definitions. Return a dictionary
where preprocessed options can be found. Calling [::getopt::run dict id]
will apply the options from group ID.
(::getopt::run): Take two arguments: the parse dictionary returned by
::getopt::parse, and the ID of the option group to run.
All uses updated.
(rex_parse_cmdline): Use three option groups: initial, which is run
before parsing anything else, global, which is parsed after sourcing
main rc file, and mode, which is parsed after sourcing hostgroup rc.
(::config::host): Append to the hostlist variable, instead of the legacy
hosts, to avoid triggering the deprecation warning.
(::config::locus): New function.
(::config::*): Use ::config::locus for diagnostic purposes.
(::config::read): Catch and process custom rex throws.
(common_config_setup): Remove.
(runcmd): Process password authentication for files passed with -D
* rex.man8: Update.
|
|
While improving rc file support and making it (hopefully) more
convenient, this commit alters the priority of rc ws. command
line settings. This will be reverted in future commits.
* rex (::getopt::parse): New option -postprocess. When given,
supplies the name of a function to be called after parsing command
line. The function returns a list of triplets: {option line file},
where option is a (list of) option and eventual argument, line and
file give the location of the corresponding statement in the rc
file. The list is then processed by calls to ::getopt::getopt,
one call per option.
(::config): Deprecate the old way of setting configuration
variables. Provide functions for each particular setting, that
make rc file look more or less like a traditional UNIX configuration
file, while still providing possibility for using full strength of
TCL.
Catch and process syntax errors.
(modetrans): New array. Translates various spellings of the mode
argument to ensure config(mode) is set uniformly.
|
|
|
|
* rex (::job): New namespace; provides functions for keeping track of the
created ssh/scp jobs.
(runcp,runcprev,runcmd,rex_login): Rewrite using job ensemble functions.
(closeproc,transition): Remove.
(add_host_key_list): Rewrite.
(hostuser,hostpass): Fix interactive mode.
(rexdbput): Bugfix
|
|
|
|
Use StrictHostKeyChecking=yes to avoid problems with eventual
interactive prompts from ssh/scp. Use LogLevel=VERBOSE to
correctly determine whether we succeeded in authenticating to
the server. Catch error output from ssh/scp in INIT state.
If any appears, reflect it on the standard error and mark
error for that host.
* README: Reword intro
* rex (max_scp_retry_count): Remove config setting.
(terror): Take optional argument -nosave.
(warning): Pass -nosave in call to terror
(hostpass): Throw error if no password defined. All uses
updated.
(runcp,runcmd): Force StrictHostKeyChecking=yes and
LogLevel=VERBOSE.
Catch state changes.
Reflect on stderr whatever received in INIT state. Raise error
state if anything was.
(runcprev): Rewrite using state machine similar to runcp.
(rex_login): Rewrite using state machine similar to runcmd.
Catch errors. Honor -Z option and earlycmd settings.
(closeproc): Log state transition.
(transition): Log state transition.
Call hook if defined.
* rex.man8: Update.
|
|
* rex (tempfile): New function.
(maketempfile): Rewrite using tempfile. Return channel ID.
Store filename in an upvar. All uses changed.
|
|
* rex (maketempfile): Rewrite. Return {fd name}. All callers
changed.
(forgettempfile): New function.
(rex_command,rex_copy_to)
(rex_login): Remove calls to cleanup.
(MAIN): Call cleanup here
|
|
sudo mode.
Earlier versions used to create a temporary script wherever a pipe symbol
or whitespace had been found in the command line. This was an overkill,
and was removed in ff1b746d. However, this approach is still needed, if
a pipeline or shell control structure is passed as command in sudo mode.
This commit restores it for such cases. Another way would be to run
/bin/sh -c 'cmd', but that requires a careful preprocessing of cmd, so
I prefer a temporary, at least for the time being.
* rex (maketempfile): Register the created file in the global
list for further removal before exiting.
(editdb): Setting trap not needed now.
(cleanup): Remove files listed in cleanup_files
(ispipeline): New function
(rex_command): Fall back to copy mode when passing what looks like a
pipeline or control flow statement in sudo mode.
(MAIN): Set trap.
|
|
|
|
* install: Fix missing dereference
* rex (runcmd): Use -f option when cleaning up
temporary directory.
|
|
|
|
* install: Install packages
* rc.tcl: Remove.
* rex.exp: Rename back to rex
* README: Update.
* README-hacking: Update.
|
|
|
|
* rex.exp: Prefer quoted conditionals; Expand {N} and {} to
filename parts.
* rex.man8: Clarify the semantics of {} and {N}
|
|
|
|
|
|
* install: New file.
* GNUmakefile: Rewrite.
* Makefile.am: Remove.
* configure.ac: Remove.
* README-hacking: Update
* README: Update.
* rex.exp: Use absolute paths for namespaces.
|
|
|
|
|
|
* rex.exp (runcp): Turn off log_user.
Handle permission denied errors.
(rex_copy_to): New option: --sudo
(main): Remove leftover debugging hook.
* rex.man8: Update.
|
|
|
|
|
|
|
|
The new syntax is:
rex [OPTIONS] COMMAND [ARGS...]
The COMMAND specifies the action to take. Valid values are:
run, command run command on a set of server
cp, copy copy (distribute) files to a set of servers
rcp, copy-from copy files from a server
login log in to a server
list list available hostgroups or servers in a hostgroup
edit edit rex database file
encrypt, obfuscate convert text to a form suitable for keeping passwords
in the rex database file
This is incompatible change.
Another important change: scripts transferred to target machines can be
written in whatever scripting language, provided they start with the proper
shebang marker, or the --interpeter option is used.
* rex.exp (version): Set 3.90
(config_option): Take second optional argument.
(getopt::parse): Alternative interface.
(prusage,shortopts,longopts): Remove
Use ::getopt::parse to parse options.
(hostlist_setup): Additional functionality.
(common_config_setup,cleanup)
(getiterpreter): New functions.
(rex_command,rex_list,rex_copy_from)
(rex_copy_to,rex_login,rex_editdb)
(rex_obfuscate): New functions
(main): Expect first word in the command line to be the command.
(hostproc::load): New function.
(rexdbget): New option -return. All uses updated.
(getans): Bugfix
(hostuser): Check for env(USER). All uses updated.
* rex.man8: Update
|
|
|
|
* rex.exp: Improve the handling of the -s option: mark it as requiring
argument, instead of getting the first word from the $argv list; provide
long option equivalent (--source).
(argcvshift): New function. Use to shift the first word from $argv/$argc.
(moresid): Remove unused function.
Remove unused code left over after ff1b746d.
* rex.man8: Update.
* ChangeLog.amend: Update.
|
|
The operation mode is kept in config(mode). A switch is used to select
the code block corresponding to the mode. Main loop is moved to a
separate function. Two new options are introduced: --verbose enables
additional warnings, and --shell starts interactive shell (same as
"rex shell host"), actually.
|
|
* rex.exp (pmres::host_order_cache): New variable
(pmres::hostorder): Use host_order_cache instead of
config(hostorder)
* rex.man8: Update.
|
|
|
|
|
|
|
|
|
|
|
|
Note: breaks backward compatibility.
* rex.exp (listgroups): Sort groups in lexicographic order
(main): Look up rc file in the $dir/hostgroup/[config_option hostgroup]
directory
|