From b5a5eac0801e12b754e5d3363867c7177d07bd03 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Sat, 30 Mar 2024 18:05:02 -0500 Subject: [PATCH] Fold long src lines. --- README.org | 114 ++++++++++++----------- abbey | 4 +- roles_t/abbey-cloister/tasks/main.yml | 5 +- roles_t/abbey-core/files/abbey_pisensors | 92 +++++++++--------- roles_t/abbey-core/tasks/main.yml | 5 +- 5 files changed, 115 insertions(+), 105 deletions(-) diff --git a/README.org b/README.org index fc962ff..e2d6b62 100644 --- a/README.org +++ b/README.org @@ -968,8 +968,9 @@ Core itself will benefit from using the package cache. - name: Use the local Apt package cache. become: yes copy: - content: | - Acquire::http::Proxy "http://apt-cacher.{{ domain_priv }}.:3142"; + content: > + Acquire::http::Proxy + "http://apt-cacher.{{ domain_priv }}.:3142"; dest: /etc/apt/apt.conf.d/01proxy mode: u=rw,g=r,o=r #+END_SRC @@ -1048,7 +1049,8 @@ print_help() { echo "" print_usage echo "" - echo "This plugin checks hardware status using the lm_sensors package." + echo "This plugin checks hardware status using" \ + "the lm_sensors package." echo "" support exit $STATE_OK @@ -1056,55 +1058,56 @@ print_help() { brief_data() { echo "$1" | sed -n -E -e ' - /^temp[0-9]+: +[-+][0-9.]+.?C/ { s/^temp[0-9]+: +([-+][0-9.]+).?C.*/ \1/; H } + /^temp[0-9]+: +[-+][0-9.]+.?C/ { + s/^temp[0-9]+: +([-+][0-9.]+).?C.*/ \1/; H } $ { x; s/\n//g; p }' } case "$1" in - --help) - print_help - exit $STATE_OK - ;; - -h) - print_help - exit $STATE_OK - ;; - --version) - print_revision $PROGNAME $REVISION - exit $STATE_OK - ;; - -V) - print_revision $PROGNAME $REVISION - exit $STATE_OK - ;; - *) - sensordata=`sensors 2>&1` - status=$? - if test ${status} -eq 127; then - text="SENSORS UNKNOWN - command not found" - text="$text (did you install lmsensors?)" - exit=$STATE_UNKNOWN - elif test ${status} -ne 0; then - text="WARNING - sensors returned state $status" - exit=$STATE_WARNING - elif echo ${sensordata} | egrep ALARM > /dev/null; then - text="SENSOR CRITICAL -`brief_data "${sensordata}"`" - exit=$STATE_CRITICAL - elif echo ${sensordata} | egrep FAULT > /dev/null \ - && test "$1" != "-i" -a "$1" != "--ignore-fault"; then - text="SENSOR UNKNOWN - Sensor reported fault" - exit=$STATE_UNKNOWN - else - text="SENSORS OK -`brief_data "${sensordata}"`" - exit=$STATE_OK - fi - - echo "$text" - if test "$1" = "-v" -o "$1" = "--verbose"; then - echo ${sensordata} - fi - exit $exit - ;; +--help) + print_help + exit $STATE_OK + ;; +-h) + print_help + exit $STATE_OK + ;; +--version) + print_revision $PROGNAME $REVISION + exit $STATE_OK + ;; +-V) + print_revision $PROGNAME $REVISION + exit $STATE_OK + ;; +*) + sensordata=`sensors 2>&1` + status=$? + if test ${status} -eq 127; then + text="SENSORS UNKNOWN - command not found" + text="$text (did you install lmsensors?)" + exit=$STATE_UNKNOWN + elif test ${status} -ne 0; then + text="WARNING - sensors returned state $status" + exit=$STATE_WARNING + elif echo ${sensordata} | egrep ALARM > /dev/null; then + text="SENSOR CRITICAL -`brief_data "${sensordata}"`" + exit=$STATE_CRITICAL + elif echo ${sensordata} | egrep FAULT > /dev/null \ + && test "$1" != "-i" -a "$1" != "--ignore-fault"; then + text="SENSOR UNKNOWN - Sensor reported fault" + exit=$STATE_UNKNOWN + else + text="SENSORS OK -`brief_data "${sensordata}"`" + exit=$STATE_OK + fi + + echo "$text" + if test "$1" = "-v" -o "$1" = "--verbose"; then + echo ${sensordata} + fi + exit $exit + ;; esac #+END_SRC @@ -1540,8 +1543,9 @@ while. - name: Use the local Apt package cache. become: yes copy: - content: | - Acquire::http::Proxy "http://apt-cacher.{{ domain_priv }}.:3142"; + content: > + Acquire::http::Proxy + "http://apt-cacher.{{ domain_priv }}.:3142"; dest: /etc/apt/apt.conf.d/01proxy mode: u=rw,g=r,o=r #+END_SRC @@ -2792,7 +2796,8 @@ creates =~/.xmltv/tv_grab_zz_sdjson.conf=, which is copied to Afterwards any re-configuration should use the following command. #+BEGIN_SRC sh -tv_grab_zz_sdjson --configure --config-file ~/.mythtv/Mr.Antenna.xmltv +tv_grab_zz_sdjson --configure \ + --config-file ~/.mythtv/Mr.Antenna.xmltv #+END_SRC Here is a transcript of a session with ~tv_grab_zz_sdjson~. Note that @@ -3044,7 +3049,8 @@ Direct account. The administrator then runs the ~tv_grab_zz_sdjson~ program as user ~mythtv~. #+BEGIN_SRC sh -tv_grab_zz_sdjson --configure --config-file ~/.mythtv/Mr.Antenna.xmltv +tv_grab_zz_sdjson --configure \ + --config-file ~/.mythtv/Mr.Antenna.xmltv #+END_SRC The program will prompt for the zip code and offer a list of "inputs" @@ -3483,8 +3489,8 @@ if ($ARGV[0] eq "tz") { #+CAPTION: =abbey= #+BEGIN_SRC perl :tangle abbey -die - "usage: $0 [config,new,old,pass,client,upgrade,reboots,versions]\n"; +my $ops = "config,new,old,pass,client,upgrade,reboots,versions"; +die "usage: $0 [$ops]\n"; #+END_SRC diff --git a/abbey b/abbey index 9f8ec93..779eab4 100755 --- a/abbey +++ b/abbey @@ -44,5 +44,5 @@ if ($ARGV[0] eq "tz") { "playbooks/timezone.yml"); } -die - "usage: $0 [config,new,old,pass,client,upgrade,reboots,versions]\n"; +my $ops = "config,new,old,pass,client,upgrade,reboots,versions"; +die "usage: $0 [$ops]\n"; diff --git a/roles_t/abbey-cloister/tasks/main.yml b/roles_t/abbey-cloister/tasks/main.yml index f326a8b..db8c390 100644 --- a/roles_t/abbey-cloister/tasks/main.yml +++ b/roles_t/abbey-cloister/tasks/main.yml @@ -2,8 +2,9 @@ - name: Use the local Apt package cache. become: yes copy: - content: | - Acquire::http::Proxy "http://apt-cacher.{{ domain_priv }}.:3142"; + content: > + Acquire::http::Proxy + "http://apt-cacher.{{ domain_priv }}.:3142"; dest: /etc/apt/apt.conf.d/01proxy mode: u=rw,g=r,o=r diff --git a/roles_t/abbey-core/files/abbey_pisensors b/roles_t/abbey-core/files/abbey_pisensors index 1901f5e..6fcb787 100644 --- a/roles_t/abbey-core/files/abbey_pisensors +++ b/roles_t/abbey-core/files/abbey_pisensors @@ -16,7 +16,8 @@ print_help() { echo "" print_usage echo "" - echo "This plugin checks hardware status using the lm_sensors package." + echo "This plugin checks hardware status using" \ + "the lm_sensors package." echo "" support exit $STATE_OK @@ -24,53 +25,54 @@ print_help() { brief_data() { echo "$1" | sed -n -E -e ' - /^temp[0-9]+: +[-+][0-9.]+.?C/ { s/^temp[0-9]+: +([-+][0-9.]+).?C.*/ \1/; H } + /^temp[0-9]+: +[-+][0-9.]+.?C/ { + s/^temp[0-9]+: +([-+][0-9.]+).?C.*/ \1/; H } $ { x; s/\n//g; p }' } case "$1" in - --help) - print_help - exit $STATE_OK - ;; - -h) - print_help - exit $STATE_OK - ;; - --version) - print_revision $PROGNAME $REVISION - exit $STATE_OK - ;; - -V) - print_revision $PROGNAME $REVISION - exit $STATE_OK - ;; - *) - sensordata=`sensors 2>&1` - status=$? - if test ${status} -eq 127; then - text="SENSORS UNKNOWN - command not found" - text="$text (did you install lmsensors?)" - exit=$STATE_UNKNOWN - elif test ${status} -ne 0; then - text="WARNING - sensors returned state $status" - exit=$STATE_WARNING - elif echo ${sensordata} | egrep ALARM > /dev/null; then - text="SENSOR CRITICAL -`brief_data "${sensordata}"`" - exit=$STATE_CRITICAL - elif echo ${sensordata} | egrep FAULT > /dev/null \ - && test "$1" != "-i" -a "$1" != "--ignore-fault"; then - text="SENSOR UNKNOWN - Sensor reported fault" - exit=$STATE_UNKNOWN - else - text="SENSORS OK -`brief_data "${sensordata}"`" - exit=$STATE_OK - fi +--help) + print_help + exit $STATE_OK + ;; +-h) + print_help + exit $STATE_OK + ;; +--version) + print_revision $PROGNAME $REVISION + exit $STATE_OK + ;; +-V) + print_revision $PROGNAME $REVISION + exit $STATE_OK + ;; +*) + sensordata=`sensors 2>&1` + status=$? + if test ${status} -eq 127; then + text="SENSORS UNKNOWN - command not found" + text="$text (did you install lmsensors?)" + exit=$STATE_UNKNOWN + elif test ${status} -ne 0; then + text="WARNING - sensors returned state $status" + exit=$STATE_WARNING + elif echo ${sensordata} | egrep ALARM > /dev/null; then + text="SENSOR CRITICAL -`brief_data "${sensordata}"`" + exit=$STATE_CRITICAL + elif echo ${sensordata} | egrep FAULT > /dev/null \ + && test "$1" != "-i" -a "$1" != "--ignore-fault"; then + text="SENSOR UNKNOWN - Sensor reported fault" + exit=$STATE_UNKNOWN + else + text="SENSORS OK -`brief_data "${sensordata}"`" + exit=$STATE_OK + fi - echo "$text" - if test "$1" = "-v" -o "$1" = "--verbose"; then - echo ${sensordata} - fi - exit $exit - ;; + echo "$text" + if test "$1" = "-v" -o "$1" = "--verbose"; then + echo ${sensordata} + fi + exit $exit + ;; esac diff --git a/roles_t/abbey-core/tasks/main.yml b/roles_t/abbey-core/tasks/main.yml index a624ee4..52d7a3e 100644 --- a/roles_t/abbey-core/tasks/main.yml +++ b/roles_t/abbey-core/tasks/main.yml @@ -186,8 +186,9 @@ - name: Use the local Apt package cache. become: yes copy: - content: | - Acquire::http::Proxy "http://apt-cacher.{{ domain_priv }}.:3142"; + content: > + Acquire::http::Proxy + "http://apt-cacher.{{ domain_priv }}.:3142"; dest: /etc/apt/apt.conf.d/01proxy mode: u=rw,g=r,o=r -- 2.25.1