Bug#678030: unattended-upgrades: No 'fancy' output init.d script

2012-06-21 Thread Teodor MICU
reopen 678030
stop

2012/6/19 Michael Vogt :
> Thanks a lot! I updated bzr to include your version with some small
> modifications. Looking at the README.Debian.gz from lsb-base it
> appears that log_action_begin_msg and log_action_end_msg is actually
> closer to what we want as the other one appears to be more for daemons
> and the check may take some time (usually not though of
> course). Please let me know if you agree with this change.

Indeed, I agree that "daemon" was not appropriate here. Note below
that there was a typo that prevented the above plan to be perfect! :-)

> I wasn't sure about VERBOSE but followed your example and left it
> in. It seems like a lot of the scripts in /etc/init.d do not really
> honor it.

Yes, but the design is also broken. This is all or nothing, black or
white. In practice we have the need to write very important messages
(like syslog priorities emergency, critical, error) , thus VERBOSE
should not be considered.

> Please double check bzr trunk (bzr branch lp:unattended-upgrades gives
> it to you) if it all makes sense :)

Checking your changes it doesn't appear good:

root@frost:~# /etc/init.d/unattended-upgrades stop
[info] Checking for running unattended package upgrades unattended-upgrades.
done.

So, I took a look at the README in lsb-base and saw that you used
"log_action_msg" -- probably a typo since your plan was different.
With the patch below (and attached u-a script) the output is:

root@frost:~# /etc/init.d/unattended-upgrades2 stop
[ ok ] Checking for running unattended package upgrades...done
(unattended-upgrades).

One last note on the code style. Probably your editor (I use «geany»
for text and shell scripts) prefers or is configured to insert 4
spaces instead of a tab. I would advice to either use only tabs or
only 2/4/8 spaces, as you prefer.
(On "case" options I don't add any indent -- from C/kernel coding style.)

Thanks


# diff -u -w /etc/init.d/unattended-upgrades /etc/init.d/unattended-upgrades2
--- /etc/init.d/unattended-upgrades 2012-06-21 17:50:49.0 +0300
+++ /etc/init.d/unattended-upgrades22012-06-22 09:03:25.687317012 +0300
@@ -32,9 +32,9 @@
;;
 stop)
if [ -e $SHUTDOWN_HELPER ]; then
-   [ "$VERBOSE" != "no" ] && log_action_msg "Checking for running
$DESC" "$NAME"
+   [ "$VERBOSE" != "no" ] && log_action_begin_msg "Checking for 
running $DESC"
python $SHUTDOWN_HELPER
-   [ "$VERBOSE" != "no" ] && log_action_end_msg $?
+   [ "$VERBOSE" != "no" ] && log_action_end_msg $? "$NAME"
fi
;;
 *)


unattended-upgrades2
Description: Binary data


Bug#678030: unattended-upgrades: No 'fancy' output init.d script

2012-06-19 Thread Michael Vogt
On Tue, Jun 19, 2012 at 10:31:11AM +0300, Teodor MICU wrote:
> 2012/6/18 Kees de Jong :
> > unattended-upgrades doesn't seem to have a 'fancy' LSB output in the init.d
> > Could you please add them?
> 
> I've updated u-a script to be fancy! :-)
> Hopefully I haven't introduced any functional changes. I've used the
> example from skeleton script.
> 
> Michael, you can adapt it to your scripting style or I can do it if
> you consider something needs to be changed.
> 
> If VERBOSE is not set nothing is printed on console. If VERBOSE is set
> (in rcS) than this will be printed on console:
> root@frost:~#./unattended-upgrades stop
> [ ok ] Checking for running unattended package upgrades: unattended-upgrades.

Thanks a lot! I updated bzr to include your version with some small
modifications. Looking at the README.Debian.gz from lsb-base it
appears that log_action_begin_msg and log_action_end_msg is actually
closer to what we want as the other one appears to be more for daemons
and the check may take some time (usually not though of
course). Please let me know if you agree with this change.

I wasn't sure about VERBOSE but followed your example and left it
in. It seems like a lot of the scripts in /etc/init.d do not really
honor it.

Please double check bzr trunk (bzr branch lp:unattended-upgrades gives
it to you) if it all makes sense :)
 
> --
> Maybe this should be considered too? It should not attempt to open the
> log file if later will have nothing to write on it.
> 
> doru@frost:~$ ./unattended-upgrades stop
> [] Checking for running unattended package upgrades:
> unattended-upgradesTraceback (most recent call last):
>   File "/usr/share/unattended-upgrades/unattended-upgrade-shutdown",
> line 107, in 
> format="%(asctime)s %(levelname)s - %(message)s")
>   File "/usr/lib/python2.7/logging/__init__.py", line 1527, in basicConfig
> hdlr = FileHandler(filename, mode)
>   File "/usr/lib/python2.7/logging/__init__.py", line 901, in __init__
> StreamHandler.__init__(self, self._open())
>   File "/usr/lib/python2.7/logging/__init__.py", line 924, in _open
> stream = open(self.baseFilename, self.mode)
> IOError: [Errno 13] Permission denied:
> '/var/log/unattended-upgrades/unattended-upgrades-shutdown.log'

Yeah, that is a valid suggestion, its a bit tricky because when it
opens the logfile its not clear yet if it needs to write something to
it later or not.

Cheers,
 Michael



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#678030: unattended-upgrades: No 'fancy' output init.d script

2012-06-19 Thread Teodor MICU
2012/6/18 Kees de Jong :
> unattended-upgrades doesn't seem to have a 'fancy' LSB output in the init.d
> Could you please add them?

I've updated u-a script to be fancy! :-)
Hopefully I haven't introduced any functional changes. I've used the
example from skeleton script.

Michael, you can adapt it to your scripting style or I can do it if
you consider something needs to be changed.

If VERBOSE is not set nothing is printed on console. If VERBOSE is set
(in rcS) than this will be printed on console:
root@frost:~#./unattended-upgrades stop
[ ok ] Checking for running unattended package upgrades: unattended-upgrades.

Cheers


--
Maybe this should be considered too? It should not attempt to open the
log file if later will have nothing to write on it.

doru@frost:~$ ./unattended-upgrades stop
[] Checking for running unattended package upgrades:
unattended-upgradesTraceback (most recent call last):
  File "/usr/share/unattended-upgrades/unattended-upgrade-shutdown",
line 107, in 
format="%(asctime)s %(levelname)s - %(message)s")
  File "/usr/lib/python2.7/logging/__init__.py", line 1527, in basicConfig
hdlr = FileHandler(filename, mode)
  File "/usr/lib/python2.7/logging/__init__.py", line 901, in __init__
StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 924, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied:
'/var/log/unattended-upgrades/unattended-upgrades-shutdown.log'


unattended-upgrades
Description: Binary data


Bug#678030: unattended-upgrades: No 'fancy' output init.d script

2012-06-18 Thread Kees de Jong
Package: unattended-upgrades
Version: 0.76.3
Severity: minor

Hi,

unattended-upgrades doesn't seem to have a 'fancy' LSB output in the init.d
Could you please add them? http://lists.debian.org/debian-
devel/2012/04/msg00110.html

Thanks.



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages unattended-upgrades depends on:
ii  apt0.9.6
ii  apt-utils  0.9.6
ii  debconf [debconf-2.0]  1.5.43
ii  lsb-release4.1+Debian6
ii  python 2.7.3~rc2-1
ii  python-apt 0.8.4
ii  ucf3.0025+nmu3

unattended-upgrades recommends no packages.

Versions of packages unattended-upgrades suggests:
ii  bsd-mailx  8.1.2-0.2006cvs-1

-- debconf information:
  unattended-upgrades/enable_auto_updates: false



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org