Bug 25826 - Traceback in uvmm_restory.py, wenn neuer Symlink auf README schon vorhanden
Traceback in uvmm_restory.py, wenn neuer Symlink auf README schon vorhanden
Status: CLOSED WORKSFORME
Product: UCS
Classification: Unclassified
Component: Virtualization - UVMM
UCS 2.4
Other Linux
: P5 minor (vote)
: UCS 3.1
Assigned To: Philipp Hahn
Janek Walkenhorst
: interim-3
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-01-13 08:56 CET by Tim Petersen
Modified: 2012-12-12 21:09 CET (History)
3 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Troubleshooting
Max CVSS v3 score:
hahn: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Petersen univentionstaff 2012-01-13 08:56:17 CET
Folgender Traceback wurde über Ticket 2012011121005803 nach einem ucr commit gemeldet:


[...]
File: /etc/libvirt/libvirtd.conf
File: /etc/default/libvirt-bin
Module: uvmm_restore
Traceback (most recent call last):
  File "/usr/sbin/ucr", line 42, in ?
    ub.main(sys.argv[1:])
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 1471, in
main
    handlers[ action ][ 0 ]( args, cmd_opts )
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 964, in
handler_commit
    c.commit(b, args)
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 829, in
commit
    object((bc, d))
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 546, in
__call__
    runModule(self.module, 'generate', bc, changed)
  File "/usr/lib/python2.4/site-packages/univention/config_registry.py", line 403, in
runModule
    arg2meth[arg](module)(bc, changes)
  File "/etc/univention/templates/modules/uvmm_restore.py", line 48, in handler
    os.symlink(
'/usr/share/doc/univention-virtual-machine-manager-node-common/README.restore',
new_symlink )
OSError: [Errno 17] File exists
Comment 1 Philipp Hahn univentionstaff 2012-01-13 09:42:40 CET
ucs-3.0/ucs/virtualization/univention-virtual-machine-manager-node/conffiles/uvmm_restore.py:47
> if new and os.path.isdir( new ) and not os.path.exists( new_symlink ):
>   os.symlink( '/usr/share/doc/univention-virtual-machine-manager-node-common/README.restore', new_symlink )

os.path.exists() folgt hier dem (kaputten?) Symlink und meldet folgerichtig False zurück. Da Anschließende os.symlink() probiert dann den Link erneut anzulegen, was dann fehlschlägt.


diff --git a/branches/ucs-3.0/ucs/virtualization/univention-virtual-machine-manager-node/conffiles/uvmm_restore.py b/branches/ucs-3.0/ucs/virtualization/univention-virtual-machine-manager-node/conffiles/uvmm_restore.py
index 347ec7b..bd8bbe1 100644
--- a/branches/ucs-3.0/ucs/virtualization/univention-virtual-machine-manager-node/conffiles/uvmm_restore.py
+++ b/branches/ucs-3.0/ucs/virtualization/univention-virtual-machine-manager-node/conffiles/uvmm_restore.py
@@ -32,6 +32,9 @@
 # <http://www.gnu.org/licenses/>.
 
 import os
+import errno
+
+README = '/usr/share/doc/univention-virtual-machine-manager-node-common/README.restore'
 
 def handler( ucr, changes ):
 	try:
@@ -44,5 +47,9 @@ def handler( ucr, changes ):
 		if os.path.exists( old_symlink ):
 			os.unlink( old_symlink )
 	new_symlink = os.path.join( new, 'README.restore' )
-	if new and os.path.isdir( new ) and not os.path.exists( new_symlink ):
-		os.symlink( '/usr/share/doc/univention-virtual-machine-manager-node-common/README.restore', new_symlink )
+	if new and os.path.isdir( new ) and not os.path.exists( new_symlink ) and os.path.exists(README):
+		try:
+			os.symlink(README, new_symlink)
+		except OSError, e:
+			if e.errno != errno.EEXIST:
+				raise
Comment 2 Philipp Hahn univentionstaff 2012-08-06 09:42:34 CEST
Der Patch ist bereits mit svn30945 seit Februar 2012 im Rahmen der RTC-Umbauten eingespielt.
Comment 3 Janek Walkenhorst univentionstaff 2012-11-20 14:14:15 CET
Kein Traceback wenn die Datei
 /usr/share/doc/univention-virtual-machine-manager
fehlt.
Comment 4 Stefan Gohmann univentionstaff 2012-12-12 21:09:46 CET
UCS 3.1-0 has been released: 
 http://forum.univention.de/viewtopic.php?f=54&t=2125

If this error occurs again, please use "Clone This Bug".