Warning: Can't synchronize with repository "(default)" (/home/git/ome.git does not appear to be a Git repository.). Look in the Trac log for more information.
Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #12002 (closed)

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

BUG: bin/omero read-only operations rewrite config.xml

Reported by: spli Owned by: jamoore
Priority: critical Milestone: 5.0.1
Component: Configuration Version: 5.0.0-rc2
Keywords: n.a. Cc: jamoore, sbesson,
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: n.a.

Description

Add an additional print statement to config.py; it turns out the file is rewritten twice, before and after displaying the config values. This can lead to loss of config.xml- if the filesystem runs out of space an empty file will be written even though a user would not expect config get to modify anything.

$ diff -U5 OMERO-CURRENT/lib/python/omero/config.py.orig OMERO-CURRENT/lib/python/omero/config.py
--- OMERO-CURRENT/lib/python/omero/config.py.orig	2014-02-11 14:34:18.000000000 +0000
+++ OMERO-CURRENT/lib/python/omero/config.py	2014-02-19 10:38:15.000000000 +0000
@@ -237,10 +237,13 @@
     def save(self):
         """
         Creates a fresh <icegrid> block (removing any unwanted
         intra-element whitespace) and overwrites the file on disk.
         """
+
+        print 'Saving %s' % self
+
         icegrid = Element("icegrid")
         comment = Comment("\n".join(["\n",
         "\tThis file was generated at %s by the OmeroConfig system.",
         "\tDo not edit directly but see bin/omero config for details.",
         "\tThis file may be included into your IceGrid application.",
$ OMERO-CURRENT/bin/omero config get
Saving <omero.config.ConfigXml object at 0x10c7f2850>
omero.data.dir=/OMERO
...
omero.web.debug=True
Saving <omero.config.ConfigXml object at 0x10c0b1f10>

config.py: ConfigXml.__init__ sets self.save_on_close = True

Change History (7)

comment:1 Changed 10 years ago by spli

  • Cc sbesson added

comment:2 Changed 10 years ago by spli

In addition Roger suggested we should use a safe rewrite where it does need to be saved, i.e. save to a temporary file and rename.

comment:3 Changed 10 years ago by jamoore

  • Milestone changed from Unscheduled to 5.0.1
  • Priority changed from major to critical

Agreed.

comment:4 Changed 10 years ago by jamoore

  • Owner set to jamoore
  • Status changed from new to accepted

comment:5 Changed 10 years ago by jamoore

  • Resolution set to fixed
  • Status changed from accepted to closed

comment:6 Changed 10 years ago by jmoore <josh@…>

  • Remaining Time set to 0

(In [31bd14990094c007c9430773a05f92b4f08771f1/ome.git] on branch develop) Use temp/rename for config.xml writing (Fix #12002)

comment:7 Changed 10 years ago by jmoore <josh@…>

(In [cd570cbffc8b187964475386131ff62f0e886a64/ome.git] on branch develop) Prevent save_on_close from omeroweb/settings.py (See #12002)

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.66570 sec.)

We're Hiring!