Skip to content

Commit

Permalink
Merge pull request #3703 from kgaillot/backport
Browse files Browse the repository at this point in the history
Backport recent fixes to 2.1 branch
  • Loading branch information
kgaillot authored Oct 21, 2024
2 parents aad0f82 + 6506a0b commit 83c55bd
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 22 deletions.
11 changes: 6 additions & 5 deletions agents/ocf/attribute.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# ocf:pacemaker:attribute resource agent
#
# Copyright 2016-2023 the Pacemaker project contributors
# Copyright 2016-2024 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
Expand All @@ -14,15 +14,16 @@ USAGE="Usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-d
Expects to have a fully populated OCF RA-compliant environment set."

# Load OCF helper functions
# If the OCF helper funtions aren't available, we can still show metadata.
: ${OCF_FUNCTIONS:="${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs"}
. "${OCF_FUNCTIONS}"
[ -r "${OCF_FUNCTIONS}" ] && . "${OCF_FUNCTIONS}"

: ${__OCF_ACTION:="$1"}

# Ensure certain variables are set and not empty
: ${HA_VARRUN:="/var/run"}
: ${HA_VARRUN:="@runstatedir@"}
: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
: ${OCF_RESOURCE_INSTANCE:="undef"}
: ${OCF_RESOURCE_INSTANCE:="RESOURCENAME"}

DEFAULT_STATE_FILE="${HA_VARRUN%%/}/opa-${OCF_RESOURCE_INSTANCE}.state"
if [ "${OCF_RESKEY_CRM_meta_globally_unique}" = "false" ]; then
Expand Down
3 changes: 2 additions & 1 deletion daemons/pacemakerd/pcmkd_subdaemons.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <grp.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
Expand Down Expand Up @@ -452,7 +453,7 @@ start_child(pcmk_child_t * child)
use_valgrind = FALSE;
}

if ((child->uid != 0) && (crm_user_lookup(child->uid, &uid, &gid) < 0)) {
if ((child->uid != NULL) && (crm_user_lookup(child->uid, &uid, &gid) < 0)) {
crm_err("Invalid user (%s) for subdaemon %s: not found",
child->uid, child->name);
return EACCES;
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/Pacemaker_Explained/resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ more detail below:
* lsb
* systemd
* service
* stonithd
* stonith
* nagios *(deprecated since 2.1.6)*
* upstart *(deprecated since 2.1.0)*

Expand Down
2 changes: 1 addition & 1 deletion lib/common/strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ pcmk_parse_interval_spec(const char *input, guint *result_ms)
msec = crm_get_msec(input);
}

if (msec == PCMK__PARSE_INT_DEFAULT) {
if (msec < 0) {
crm_warn("Using 0 instead of invalid interval specification '%s'",
input);
msec = 0;
Expand Down
4 changes: 1 addition & 3 deletions mk/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ am__v_BOOK_1 =
MAINTAINERCLEANFILES = Makefile.in

AM_CPPFLAGS = -I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_builddir)/libltdl \
-I$(top_srcdir)/libltdl
-I$(top_srcdir)/include
3 changes: 3 additions & 0 deletions tools/crmadmin.8.inc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ crmadmin [options] [node]

/the Pacemaker controller/
.SH OPTIONS

/query information/
.SH NOTES
25 changes: 14 additions & 11 deletions tools/crmadmin.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct {
char *ipc_name;
gboolean bash_export;
} options = {
.timeout = 30000, // Default to 30 seconds
.optarg = NULL,
.ipc_name = NULL,
.bash_export = FALSE
Expand Down Expand Up @@ -80,9 +81,10 @@ static GOptionEntry command_options[] = {

static GOptionEntry additional_options[] = {
{ "timeout", 't', 0, G_OPTION_ARG_CALLBACK, command_cb,
"Time to wait before declaring the operation"
"\n failed",
"TIMESPEC"
"Time to wait before declaring the operation"
"\n "
"failed (default 30s; use 0 to disable timeout)",
"DURATION"
},
{ "bash-export", 'B', 0, G_OPTION_ARG_NONE, &options.bash_export,
"Display nodes as shell commands of the form 'export uname=uuid'"
Expand Down Expand Up @@ -131,17 +133,18 @@ static pcmk__supported_format_t formats[] = {
{ NULL, NULL, NULL }
};

#define DESC \
"Notes:\n\n" \
"DURATION in any command line option can be specified as an integer\n" \
"number of seconds, an integer plus units (ms, msec, us, usec, s, sec,\n" \
"m, min, h, or hr), or an ISO 8601 period specification.\n\n" \
"Report bugs to " PCMK__BUG_URL


static GOptionContext *
build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) {
GOptionContext *context = NULL;

const char *description = "Notes:\n\n"
"Time Specification:\n\n"
"The TIMESPEC in any command line option can be specified in many different\n"
"formats. It can be just an integer number of seconds, a number plus units\n"
"(ms/msec/us/usec/s/sec/m/min/h/hr), or an ISO 8601 period specification.\n\n"
"Report bugs to " PCMK__BUG_URL;

GOptionEntry extra_prog_entries[] = {
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &(args->quiet),
"Display only the essential query information",
Expand All @@ -151,7 +154,7 @@ build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) {
};

context = pcmk__build_arg_context(args, "text (default), xml", group, NULL);
g_option_context_set_description(context, description);
g_option_context_set_description(context, DESC);

/* Add the -q option, which cannot be part of the globally supported options
* because some tools use that flag for something else.
Expand Down

0 comments on commit 83c55bd

Please sign in to comment.