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!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
For example:
In /home/martins/samba/samba/ctdb/tools/onnode line 304:
[ "$nodes" != "${nodes%[ ${nl}]*}" ] && verbose=true
^---^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns.
Did you mean:
[ "$nodes" != "${nodes%[ "${nl}"]*}" ] && verbose=true
For more information:
https://www.shellcheck.net/wiki/SC2295 -- Expansions inside ${..} need to b...
Who knew? Thanks ShellCheck!
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Drop some unnecessary whitespace and re-indent push().
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Options can be set in ONNODE_SSH, so this variable is unnecessary.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This covers the following:
SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
POSIX agrees that -a and -o should not be used:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
Fixing these doesn't cause much churn.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Commit 90de5e0594 remove the processing
for this option but forgot to remove it from the getopts command.
Versions of ShellCheck >= 0.4.7 warn on this, so it is worth fixing.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14086
RN: Fix onnode test failure with ShellCheck >= 0.4.7
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This has been broken for 10 years since commit
9616959bd6, which introduced the
separate filtering. This commit was missing a redirect of the output
of stderr_filter() to stderr.
Since nobody depends on the separate filtering (i.e. nobody reported a
bug), just return to combining stdout and stderr, and filtering them
together.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This filter no longer does anything useful in this context. By
default it adds a pipeline with trailing cat process. In many
contexts, stdout of the process being run is still open so the cat
process will stay around and will stop onnode from exiting.
The filters should all go away because they are simply an example of
code that is trying to be too clever while causing unfortunate corner
cases.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
I don't think anyone uses this and it causes complications.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
If there aren't enough addresses in the list then the shift will
silently fail and the printed address will be the unshifted value of
$1, which is incorrect/unexpected. So, sanity check the node number.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ONNODE_SSH is really a test hook, so it doesn't need to support
completely random values.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
getopt is being used with non-portable options. Use simpler,
POSIX-compliant getopts instead.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
FreeBSD and others do not have /bin/bash, so use "/usr/bin/env bash"
for better flexibility.
There are still many integration tests that use /bin/bash but this at
least lets FreeBSD start running tests.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13520
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
onnode does not use any configuration options.
Drop sourcing of functions file since the only function used was
loadconfig().
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
stderr_filter() only does anything useful when running in
parallel (i.e. with the -p option). So, simplify the non-parallel
case by not using stderr_filter().
As a side-effect, this fixes an issue introduced in commit
85a4375788 where local daemon tests
would hang when trying to start daemons with VALGRIND set (to a
valgrind command that does not use --log-file). This is because
valgrind would keep stderr open for its output so the pipeline
involving stderr_filter() would never complete.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
loadconfig() currently tries to load the CTDB configuration and also
any system configuration relevant to the current (event) script.
Instead add a new function load_system_config() to load the
distribution-specific system configuration for a component. Call this
directly in the rare scripts that need the system configuration.
Also call load_system_config when loading the CTDB configuration to
pull in anything from the CTDB system configuration. This is partly
for backward compatibility but also to get options that can be used
anywhere.
loadconfig() no longer takes an argument. It simply loads the CTDB
configuration.
Drop support for falling back to /etc/ctdb/sysconfig/ctdb (or
similar). Surely there's nobody who uses that!
Also, drop the indirection where loadconfig() calls _loadconfig().
This was used years ago as a test hook and is no longer required.
Inexplicably, this change introduces a new shellcheck test failure, so
silence this.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Tests now deviate from the compile-time default by setting CTDB_BASE.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
No functional changes. Best viewed with diff/show -w to avoid
whitespace differences.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
CTDB_NODES_SOCKETS is no longer used. The test code uses ONNODE_SSH
to run a fake ssh client.
Leave indenting sloppy and fix it in the next commit so that this
change is clear.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Commit 635da189dc fixed a problem where
a stray file descriptor leaked into a subshell.
Explicitly close the file descriptor at the outermost possible point
rather than relying on fakessh() to do it.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Instead of more generic SSH and EXTRA_SSH_OPTS.
Quietly drop reference to rsh in case it gives anyone ideas.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Given the size of the command substitutions it would be less clear to
embed the assignments and substitutions inside a conditional. It is
clearer if the exit code is checked afterwards.
However, do fix some untidy uses of != instead of -ne when comparing
with $?. Make the code easier to understand by reversing the logic
and using -eq and ||.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
There are multiple command groups and redirects on very long lines.
Reformat the long lines to break them up and add a comment to explain
what is happening.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
SC2124: Assigning an array to a string!
Assign as array, or use * instead of @ to concatenate.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
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)