2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-27 12:52:16 +00:00
Commit Graph

2 Commits

Author SHA1 Message Date
Daniel Hilst 2f5a4dbd3a test(xcat-core): capture the empty candidate list of mysqlsetup
mysqlsetup -i reports

    comment the bind-address line failed: cannot read : No such file or
    directory

on every MySQL cluster, with no file named. Measured on xcat185-mn-tmp-84
through SN_setup_case, which then stops: the Kea configuration and the
service node install never happen.

@BIND_FILES is assigned by a top-level statement that sits below the main
flow's exit, so the statement never runs and the list is empty at run time.
$BIND_FILES[-1] is then undef. Each case in the test localizes the list, so
none of them read the value the script itself holds.

The test now asserts the list of the loaded script. 2 of its 15 checks fail
on this commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-14 18:48:54 -03:00
Daniel Hilst 8e9c1e2ab1 fix(xcat-core): mysqlsetup leaves /etc/my.cnf with the label of /tmp
mysqlsetup commented the bind-address line by writing the result to
/tmp/my.cnf and renaming it over the configuration file. A file created in
/tmp takes user_tmp_t, and a rename keeps the type of the file it moves, so
the management node was left with a MySQL configuration that mysqld is denied
read of. The denial survives the command and was seen in three rounds of the
SELinux campaign. The temporary path is also a fixed name in a world writable
directory, written as root.

comment_bind_address now reads the file, substitutes the line and writes the
result back through the same file. Truncating in place keeps the inode, which
is what carries the label, so no relabel is needed afterwards. The candidate
list moves to @BIND_FILES and the resolution order does not change: the
Ubuntu mariadb.conf.d file, then /etc/mysql/my.cnf, then /etc/my.cnf.

mysqlsetup_bind_address_label.t drives the sub against a scratch tree and
asserts the inode survives, that only a line starting with bind is commented,
and that no temporary file is left beside the target. With the rewrite put back
through a renamed file in /tmp, the inode check is the one check of the
thirteen that fails.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-10-14 16:45:33 -03:00