Bug 248173 - nut status query is broken
nut status query is broken
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: nut (Show other bugs)
7
All Linux
low Severity medium
: ---
: ---
Assigned To: Tomas Smetana
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-07-13 13:49 EDT by Michal Jaegermann
Modified: 2007-11-30 17:12 EST (History)
1 user (show)

See Also:
Fixed In Version: 2.0.5-4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-08-17 12:13:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Michal Jaegermann 2007-07-13 13:49:43 EDT
Description of problem:

/etc/rc.d/init.d/ups has the following code for status check:

                        if [ "$MODEL" = "upsdrvctl" ]; then
                                /sbin/upsdrvctl -v status
                        else
                                status $MODEL
                        fi

but '/sbin/upsdrvctl -v status' responds with this:

Network UPS Tools - UPS driver controller 2.0.5
/sbin/upsdrvctl: invalid option -- v
Starts and stops UPS drivers via ups.conf.

usage: /sbin/upsdrvctl [OPTIONS] (start | stop | shutdown) [<ups>]

  -h                    display this help
  -r <path>             drivers will chroot to <path>
  -t                    testing mode - prints actions without doing them
  -u <user>             drivers started will switch from root to <user>
  -D                    raise debugging level
  start                 start all UPS drivers in ups.conf
  start <ups>           only start driver for UPS <ups>
  stop                  stop all UPS drivers in ups.conf
  stop <ups>            only stop driver for UPS <ups>
  shutdown              shutdown all UPS drivers in ups.conf
  shutdown <ups>        only shutdown UPS <ups>

which is not what was desired.

OTOH replacing the above with

                        if [ "$MODEL" = "upsdrvctl" ]; then
                                mymodel=$(sed -n \
                                '/^[[:space:]]*driver.*=/s///p' \
                                /etc/ups/ups.conf)
                                [ "$mymodel" ] && status $mymodel
                        else
                                status $MODEL
                        fi

does show what I need if MODEL is set to "upsdrvctl" (and without
setting MODEL this way it is unclear how to make the current version
of nut to work at all).

Version-Release number of selected component (if applicable):
nut-2.0.5-3

How reproducible:
always
Comment 1 Tomas Smetana 2007-08-16 09:13:02 EDT
This should be solved in the next update (already commited and pushed).
Comment 2 Fedora Update System 2007-08-17 12:13:48 EDT
nut-2.0.5-4 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 3 Andre Robatino 2007-08-19 01:00:58 EDT
  There is no change.  Please reopen.

[andre@localhost ~]$ /sbin/upsdrvctl -v status
Network UPS Tools - UPS driver controller 2.0.5
/sbin/upsdrvctl: invalid option -- v
Starts and stops UPS drivers via ups.conf.

usage: /sbin/upsdrvctl [OPTIONS] (start | stop | shutdown) [<ups>]

  -h                    display this help
  -r <path>             drivers will chroot to <path>
  -t                    testing mode - prints actions without doing them
  -u <user>             drivers started will switch from root to <user>
  -D                    raise debugging level
  start                 start all UPS drivers in ups.conf
  start <ups>           only start driver for UPS <ups>
  stop                  stop all UPS drivers in ups.conf
  stop <ups>            only stop driver for UPS <ups>
  shutdown              shutdown all UPS drivers in ups.conf
  shutdown <ups>        only shutdown UPS <ups>
[andre@localhost ~]$ rpm -q nut
nut-2.0.5-4
[andre@localhost ~]$
Comment 4 Andre Robatino 2007-08-19 15:33:28 EDT
  Never mind, it's a misunderstanding.  I didn't read the OP's comment closely
enough and thought that one was supposed to be able to use -v directly, and
didn't realize that the real problem was that the script uses it when it
shouldn't.  Please ignore my previous comment.

Note You need to log in before you can comment on or make changes to this bug.