Added possbility to do checks based on weekday in check_exadata_zfs_share_replication plugin

Added data_has_newline()
This commit is contained in:
Patrick Van der Veken
2020-01-30 11:43:36 +01:00
parent 9fcf788b59
commit 982a237d77
5 changed files with 116 additions and 66 deletions
+23 -3
View File
@@ -30,7 +30,7 @@
# RETURNS: 0
function version_include_data
{
typeset _VERSION="2019-07-14" # YYYY-MM-DD
typeset _VERSION="2020-01-27" # YYYY-MM-DD
print "INFO: $0: ${_VERSION#version_*}"
@@ -196,10 +196,30 @@ done
return 0
}
# -----------------------------------------------------------------------------
# @(#) FUNCTION: data_has_newline()
# DOES: checks if a string contains newlines
# EXPECTS: $1=haystack [string]
# OUTPUTS: n/a
# RETURNS: 0=no newline found; 1=newlines found
# REQUIRES: n/a
function data_has_newline
{
(( ARG_DEBUG > 0 && ARG_DEBUG_LEVEL > 0 )) && set "${DEBUG_OPTS}"
typeset _HAYSTACK="${1}"
typeset _COUNT=$(print -R "${_HAYSTACK}" | wc -l 2>/dev/null)
(( _COUNT > 1 )) && return 1
return 0
}
# -----------------------------------------------------------------------------
# @(#) FUNCTION: data_magic_quote()
# DOES: magically quotes a needle in a string (default needle is: %)
# EXPECTS: $1=to be magically quoted [string]; $2=needle [string]
# EXPECTS: to be magically quoted [string]; $2=needle [string]
# OUTPUTS: magically quoted [string]
# RETURNS: n/a
# REQUIRES: n/a
@@ -217,7 +237,7 @@ return 0
# -----------------------------------------------------------------------------
# @(#) FUNCTION: data_magic_unquote()
# DOES: magically unquotes a needle in a string (default needle is: %)
# EXPECTS: $1=to be magically unquoted [string]; $2=needle [string]
# EXPECTS: to be magically unquoted [string]; $2=needle [string]
# OUTPUTS: magically unquoted [string]
# RETURNS: n/a
# REQUIRES: n/a