IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
SC2046: Quote this to prevent word splitting.
SC2086: Double quote to prevent globbing and word splitting.
Add some quoting where it makes sense. Use shellcheck directives for
false-positives.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
SC2034: VAR appears unused. Verify it or export it.
Drop some variables that are unnecessarily used. Use shellcheck
directive for false-positives.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
LVS and NAT gateway support had bit-rotted. We don't use any of these
in scripts/tests and we very much doubt anyone else uses them.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Mon Apr 25 10:34:47 CEST 2016 on sn-devel-144
In this case: ctdbd_wrapper, onnode, ctdb_diagnostics, ctdb.sudoers.
Set sensible defaults from configure options.
Update documentation to match, trying to fix up anything that has been
missed before.
The onnode unit tests need a symlink to the functions file.
The simple integration tests need to set CTDB_BASE and also
need symlinks to functions/nodes.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jose A. Rivera <jarrpa@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
fixup
Signed-off-by: Martin Schwenke <martin@meltin.net>
This can be useful for piping data to onnode in certain circumstances.
There are now also enough command-line options that they should
definitely be alphabetically ordered.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
This bit-rotted a long time ago when the "ThisNode" column was added
to "ctdb -Y status" output. The fake "ctdb -Y status" output in the
test was never updated to reflect this change.
Instead of making sure that all columns are "0", just check that
they're not "1". This implicitly ignores "Y" and "N" in this
"ThisNode" column without having to do anything else clever.
Also update associated tests. The main "ctdb ok" test had a duplicate
opening line for a here document, which was tickled by this change.
This fixes samba bz#8122.
Signed-off-by: Martin Schwenke <martin@meltin.net>
onnode test fixup
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 01a46205c3a3d6609dc0b0324319b89667dffa32)
A list of files is given rather than a command. These files are
pushed to the specified nodes.
Quoting is fragile/broken so filenames with spaces won't work - you
win some, you lose some. :-)
All of the other onnode options should work together with this option.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit aed9b98ddbbf3e81de4f7257a10676565f7d7507)
This case was never tested and fakessh obviously won't handle the
extra arguments.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 02184bd5b9ab94cdf2b9ff92e56a509f92f9e4aa)
This hasn't worked for a while if ever.
We treat this case specially because the output has 2 works on the 1st
line. We also handle the error case where /etc/ctdb_natgw_nodes
exists but none of the other $NATGW_* configuration is done.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 66e89797c7866d207a5bbf1836f52d70dba7cea6)
Setting IFS and looping though items with colons in them doesn't work.
Change this to read through the output line by line. The header line
needs to be thrown away by throwing away everything up to the 1st
newline.
Keep stderr from the "ctdb status" command, otherwise debugging is
impossible.
On error, append any output from ctdb to onnode's error message.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit d60592cf99999f10344a05ef0571fb300bb9d97c)
The comment about $CTDB_NODES_SOCKETS is meaningless. The code ti
refers to works just find with $CTDB_NODES_SOCKETS.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 74e69a564bac653dadfffe8b08145b9b3be16e61)
The current code requires knowledge of the number of status bits
output by "ctdb status -Y".
This changes the code to be completely general.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit e1788f25fde3d1f26bf4831a331741aa280f6fbc)
Use of "local" was masking errors in command-line processing.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit ca80adda7517b43147ef30156ae34c66b29fa2bd)
The current version gives the last item left after stripping the known
fields. If an insufficent number of status fields is stripped then
this would return a residual status field value, which turned out to
be a valid IP address for localhost... so no error occurs.
This change means that the node number is stripped and any residual
status field value will stay appended, causing an error the first time
this command is tested.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 74715e6ec7b67c6f0e863aa51c87279758d6bf91)
When the output of "ctdb status -Y" changed to add an extra status
column we didn't fix onnode.
This adds a match for the extra column.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 793febaebd3d484ddfbbcb47aaa0cdf3cfc1a00d)
2 changes:
* If a relative nodes file is specified via -f or $CTDB_NODES_FILE but
this file does not exist then try looking for the file in /etc/ctdb
(or $CTDB_BASE if set).
* If a nodes file is specified via -f or $CTDB_NODES_FILE but this
file does not exist (even when checked as per above) then do not
fall back to /etc/ctdb/nodes ((or $CTDB_BASE if set). The old
behaviour was surprising and hid errors.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 6b5a5bb62369284585057caf09f05d2d5e3b9927)
The -f option allows an alternate nodes file to be specified,
overriding the CTDB_NODES_FILE environment variable.
The -n option allows hostnames to be used instead of node numbers.
Using a range of hostnames is invalid, so hostnames can't contain
hyphens ('-') - sorry! You can use this option without a nodes file
by specifying "-f /dev/null".
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 46474e5f21fd97dd765c616647ff46055a9970e7)
In testing and other situations (e.g. eventscripts) it is necessary to
select a node where a ctdb command can be run. The whole idea here is
to avoid nodes where ctdbd is not running and where most ctdb commands
would fail. This implements a standard way of doing this involving a
recursive onnode command.
There is still a small window for a race, where the selected node is
suddenly shutdown, but this is unavoidable.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit fb47cce86c0edae5caaf485f13ae7a151b6cb00d)
Commit a0f5148ac749758e2dfbd6099e829c5bf1d900e6 caused a subtle
regression. Due to the subtlety, this description is much longer than
the 1 line patch that fixes it! The regression, where a process that
invokes onnode is unexpectedly blocked, is only apparent if the
following conditions are met:
1. $CTDB_NODES_SOCKETS is set;
2. The command passed to onnode attempts to background a process; and
3. onnode is run in certain types of subshell (e.g. foo=$(onnode ...)).
In particular, when testing against local daemons (i.e. condition (1)
is met), tests/simple/07_ctdb_process_exists.sh would fail (because it
does both (2), (3)).
The problem is caused by the use of file descriptor 3 in the code that
allows separate filtering of stdout and stderr. A backgrounded
process will have this descriptor open and the $(...) construct
appears to wait for all file descriptors to be closed. This only
happens with local daemons because SSH is replaced by a shell and file
descriptor 3 leaks into that shell. It does not occur when SSH is
used because the file descriptor does not leak into the remote shell
where the process is backgrounded.
The fix is simply to redirect file descriptor 3 to /dev/null in the
fakessh function, which is used when $CTDB_NODES_SOCKETS is set.
Also fixed is another minor bug when the -o option and
$CTDB_NODES_SOCKETS are used in combination. The code uses the node
name as a suffix for the output filename(s). Usually this is an IP
address. However, when $CTDB_NODES_SOCKETS is in use the node name is
the socket name, which might be a path several directories deep.
Each output file is created via a simple redirection and this would
fail if unexpected directories appear in the filename. 3 possible
fixes were considered:
1. Replace all '/'s in the node name by '_'s. Nice and simple.
2. Use the basename of the node name. However, sockets may be in
different directories but have the same basename.
3. Create all required directories before redirecting. This is a
little more complex and probably doesn't meet the user's
expectations.
Option (1) is implemented here.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit c97d56d93d9c1007a4e85affb19ed0c2d0e11b6d)
They both need to use a -Y option to ctdb and for natgwlist we only
want the 1st line.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit e781ff61e17d733349021bb036514f823c7cbfbb)
Some code re-factoring to implement this and to make it easy to
implement new ones. New simpler implementation of echo_nth() no
longer uses deleted get_nth() function.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 29559f5dd099bec210e98909c9b2e048461b7c81)
"connected". Allow "rm" or "recmaster" to be a nodespec for the
recovery master. Better error handling for interaction with ctdb
client.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 05bdafed82106a0d8bfa53cd730eb3e1db68a51f)
nodespecs. Since we're now explicitly using bash, use local variables
when sensible.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 16626eaf9c63adfe780e8f51f9cd97810647e731)
address/name. To implement this stderr has redirected to stdout -
this doesn't need to be done but is the simplest implementation.
Remove -t option since it doesn't seem to accomplish much but causes
spurious messages to be displayed by ssh. Add explicit -h and --help
options. Make style of usage message consistent with documentation.
Document new features in doc/onnode.1.xml.
(This used to be ctdb commit dfaf2c1581e547df831b3171ad47acd27b4ca2af)
address/name. To implement this stderr has redirected to stdout -
this doesn't need to be done but is the simplest implementation.
Remove -t option since it doesn't seem to accomplish much but causes
spurious messages to be displayed by ssh. Add explicit -h and --help
options. Make style of usage message consistent with documentation.
Document new features in doc/onnode.1.xml.
(This used to be ctdb commit 8119238d1fa672814a7591593b517c3c42859315)