[Python-apps-commits] r7208 - in packages/slapos.core/trunk/debian/patches (1 file)

arnau at users.alioth.debian.org arnau at users.alioth.debian.org
Sat Jun 18 12:57:26 UTC 2011


    Date: Saturday, June 18, 2011 @ 12:57:25
  Author: arnau
Revision: 7208

Do not ignore the first argument if it's not a configuration file

Modified:
  packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch

Modified: packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch
===================================================================
--- packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch	2011-06-18 09:29:33 UTC (rev 7207)
+++ packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch	2011-06-18 12:57:25 UTC (rev 7208)
@@ -80,7 +80,7 @@
 Index: slapos.core-0.3~20110608+1.git9496d81.obsolete.0.260002630137937/slapos/grid/svcbackend.py
 ===================================================================
 --- slapos.core-0.3~20110608+1.git9496d81.obsolete.0.260002630137937.orig/slapos/grid/svcbackend.py	2011-06-18 16:11:55.392004911 +0900
-+++ slapos.core-0.3~20110608+1.git9496d81.obsolete.0.260002630137937/slapos/grid/svcbackend.py	2011-06-18 16:29:08.476004929 +0900
++++ slapos.core-0.3~20110608+1.git9496d81.obsolete.0.260002630137937/slapos/grid/svcbackend.py	2011-06-18 20:40:10.696005201 +0900
 @@ -124,6 +124,8 @@
  Typical usage:
   * %prog CONFIGURATION_FILE [arguments passed to supervisor]
@@ -90,19 +90,27 @@
  """.strip()
  
    parser = OptionParser(usage=usage)
-@@ -135,9 +137,9 @@
+@@ -134,13 +136,13 @@
+   else:
      (argument_option_instance, argument_list) = \
        parser.parse_args(list(argument_tuple))
-   if len(argument_list) == 0:
+-  if len(argument_list) == 0:
 -    parser.error("Configuration file is obligatory. Consult documentation by "
 -        "calling with -h.")
 -  configuration_file = argument_list[0]
+-  if not os.path.exists(configuration_file):
+-    parser.error("Could not read configuration file : %s" \
+-        % configuration_file)
++  if (len(argument_list) == 0 or not os.path.exists(argument_list[0])) and \
++     os.path.exists('/etc/slapos/slapos.cfg'):
 +    configuration_file = '/etc/slapos/slapos.cfg'
++  elif os.path.exists(argument_list[0]):
++    configuration_file = argument_list.pop(0)
 +  else:
-+    configuration_file = argument_list.pop(0)
-   if not os.path.exists(configuration_file):
-     parser.error("Could not read configuration file : %s" \
-         % configuration_file)
++    parser.error("Configuration file not found")
+   slapgrid_configuration = ConfigParser.SafeConfigParser()
+   slapgrid_configuration.read(configuration_file)
+   # Merges the two dictionnaries
 @@ -153,7 +155,7 @@
    if not option_dict.get('supervisord_socket'):
      option_dict['supervisord_socket'] = \




More information about the Python-apps-commits mailing list