Bug 248173

Summary: nut status query is broken
Product: [Fedora] Fedora Reporter: Michal Jaegermann <michal>
Component: nutAssignee: Tomas Smetana <tsmetana>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 7CC: robatino
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.0.5-4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-08-17 16:13:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Michal Jaegermann 2007-07-13 17:49:43 UTC
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 13:13:02 UTC
This should be solved in the next update (already commited and pushed).

Comment 2 Fedora Update System 2007-08-17 16:13:48 UTC
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 05:00:58 UTC
  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 19:33:28 UTC
  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.