[Python-apps-commits] r10441 - in packages/slapos.core/trunk/debian (11 files)

arnau at users.alioth.debian.org arnau at users.alioth.debian.org
Thu Jan 30 09:54:34 UTC 2014


    Date: Thursday, January 30, 2014 @ 09:54:33
  Author: arnau
Revision: 10441

New SlapOS upstream release.

Added:
  packages/slapos.core/trunk/debian/TODO
  packages/slapos.core/trunk/debian/patches/fix_setup_depends.patch
Modified:
  packages/slapos.core/trunk/debian/changelog
  packages/slapos.core/trunk/debian/conf/slapos-client.cfg
  packages/slapos.core/trunk/debian/conf/slapos-node-unofficial.cfg
  packages/slapos.core/trunk/debian/control
  packages/slapos.core/trunk/debian/patches/series
  packages/slapos.core/trunk/debian/patches/slapos_command_split_up.patch
  packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch
  packages/slapos.core/trunk/debian/slapos-client.install
  packages/slapos.core/trunk/debian/slapos-node-unofficial.install

Added: packages/slapos.core/trunk/debian/TODO
===================================================================
--- packages/slapos.core/trunk/debian/TODO	                        (rev 0)
+++ packages/slapos.core/trunk/debian/TODO	2014-01-30 09:54:33 UTC (rev 10441)
@@ -0,0 +1,3 @@
+* dh_python2 guesses dependencies from setup.py. However as the upstream
+  source is split up into two packages, it means slapos-client ends up
+  with all the dependencies from both packages.

Modified: packages/slapos.core/trunk/debian/changelog
===================================================================
--- packages/slapos.core/trunk/debian/changelog	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/changelog	2014-01-30 09:54:33 UTC (rev 10441)
@@ -1,3 +1,9 @@
+slapos.core (1.0.2.1-1) UNRELEASED; urgency=medium
+
+  * New upstream release.
+
+ -- Arnaud Fontaine <arnau at debian.org>  Tue, 28 Jan 2014 14:15:05 +0900
+
 slapos.core (0.35.1-4) unstable; urgency=low
 
   [ Arnaud Fontaine ]

Modified: packages/slapos.core/trunk/debian/conf/slapos-client.cfg
===================================================================
--- packages/slapos.core/trunk/debian/conf/slapos-client.cfg	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/conf/slapos-client.cfg	2014-01-30 09:54:33 UTC (rev 10441)
@@ -10,24 +10,3 @@
 # Conclusion: node certificate != person certificate.
 #cert_file = certificate file location coming from your slapos master account
 #key_file = key file location coming from your slapos master account
-# Below are software supported by Vifib
-alias =
-  apache_frontend http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
-  drupal http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.141:/software/erp5/software.cfg
-  erp5 http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.117:/software/erp5/software.cfg
-  erp5scalabilitytestbed http://git.erp5.org/gitweb/slapos.git/blob_plain/erp5scalabilitytestbed:/software/erp5scalabilitytestbed/software.cfg
-  erp5_branch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg
-  kumofs http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.64:/software/kumofs/software.cfg
-  kvm http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.137:/software/kvm/software.cfg
-  mariadb http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.16-hotfix:/software/mariadb/software.cfg
-  memcached http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.43:/software/memcached/software.cfg
-  mysql http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.65:/software/mysql-5.1/software.cfg
-  nosqltester http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/nosqltestbed:/software/nosqltestbed/software.cfg
-  postgresql http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.145:/software/postgres/software.cfg
-  slaposwebrunner http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.66:/software/slaprunner/software.cfg
-  wordpress http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.141:/software/wordpress/software.cfg
-  xwiki http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.46:/software/xwiki/software.cfg
-  zabbixagent http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.95:/software/zabbix-agent/software.cfg
-
-[networkcache]
-download-binary-dir-url = http://www.shacache.org/shadir

Modified: packages/slapos.core/trunk/debian/conf/slapos-node-unofficial.cfg
===================================================================
--- packages/slapos.core/trunk/debian/conf/slapos-node-unofficial.cfg	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/conf/slapos-node-unofficial.cfg	2014-01-30 09:54:33 UTC (rev 10441)
@@ -28,6 +28,20 @@
 database_uri = /var/lib/slapos/proxy.db
 log_file = /var/log/slapos/slapproxy.log
 
+# Below is the list of software maintained by slapos.org and contributors
+# It is used to simulate a proper configuration of a real slapos master.
+software_product_list =
+  erp5 http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.195:/software/erp5/software.cfg
+  erp5_branch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg
+  kumofs http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.141:/software/kumofs/software.cfg
+  kvm http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.193:/software/kvm/software.cfg
+  maarch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.159:/software/maarch/software.cfg
+  mariadb http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.152:/software/mariadb/software.cfg
+  memcached http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.82:/software/memcached/software.cfg
+  slaposwebrunner http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.160:/software/slaprunner/software.cfg
+  wordpress http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.163:/software/wordpress/software.cfg
+  zabbixagent http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.162:/software/zabbix-agent/software.cfg
+
 [networkcache]
 # Define options for binary cache, used to download already compiled software.
 download-binary-cache-url = http://www.shacache.org/shacache

Modified: packages/slapos.core/trunk/debian/control
===================================================================
--- packages/slapos.core/trunk/debian/control	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/control	2014-01-30 09:54:33 UTC (rev 10441)
@@ -21,10 +21,11 @@
 Depends: ${misc:Depends},
          ${python:Depends},
          python-xmlmarshaller (>= 0.9.3~),
+         python-cliff,
          ucf
-# For tests only
-Suggests: python-unittest2,
-          pyflakes
+Recommends: ipython | bpython
+# For tests
+Suggests: pyflakes
 Description: Client-side to request applications with SlapOS 
  SlapOS allows one to turn any application into SaaS (Software as a Service),
  PaaS (Platform as a Service) or IaaS (Infrastructure as a Service) without
@@ -62,6 +63,8 @@
             autoconf,
             automake,
             python2.7-dev
+# For tests
+Suggests: python-mock
 Description: Node-side to deploy applications with SlapOS (unofficial)
  SlapOS allows one to turn any application into SaaS (Software as a Service),
  PaaS (Platform as a Service) or IaaS (Infrastructure as a Service) without

Added: packages/slapos.core/trunk/debian/patches/fix_setup_depends.patch
===================================================================
--- packages/slapos.core/trunk/debian/patches/fix_setup_depends.patch	                        (rev 0)
+++ packages/slapos.core/trunk/debian/patches/fix_setup_depends.patch	2014-01-30 09:54:33 UTC (rev 10441)
@@ -0,0 +1,30 @@
+commit 8f5868b5aff8a33dffe65ce1b68fc8a37f38a9c4
+Author: Arnaud Fontaine <arnaud.fontaine at nexedi.com>
+Date:   Tue Jan 28 17:06:20 2014 +0900
+
+    Make ipython and bpython optional dependencies (enhancements compared to plain Python).
+
+diff --git a/setup.py b/setup.py
+index 98b30f4..efe621b 100644
+--- a/setup.py
++++ b/setup.py
+@@ -54,14 +54,15 @@ setup(name=name,
+           'zc.buildout',
+           'cliff',
+           'requests',
+-          'ipython',
+-          'bpython',
+         ] + additional_install_requires,
+-      extra_requires={'docs': (
++      extras_require={
++      'docs': (
+         'Sphinx',
+         'repoze.sphinx.autointerface',
+         'sphinxcontrib.programoutput'
+-      ),},
++      ),
++      'ipython_console': ('ipython',),
++      'bpython_console': ('bpython',)},
+       tests_require=[
+           'pyflakes',
+           'mock'

Modified: packages/slapos.core/trunk/debian/patches/series
===================================================================
--- packages/slapos.core/trunk/debian/patches/series	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/patches/series	2014-01-30 09:54:33 UTC (rev 10441)
@@ -1,3 +1,3 @@
 system_configuration_file_by_default.patch
+fix_setup_depends.patch
 slapos_command_split_up.patch
-fix_tests_install_requires.patch

Modified: packages/slapos.core/trunk/debian/patches/slapos_command_split_up.patch
===================================================================
--- packages/slapos.core/trunk/debian/patches/slapos_command_split_up.patch	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/patches/slapos_command_split_up.patch	2014-01-30 09:54:33 UTC (rev 10441)
@@ -4,83 +4,61 @@
  The Debian package is split up into two packages, thus ``slapos node ...''
  subcommands are not available if slapos-node-unofficial is not installed.
 
---- a/slapos/entry.py
-+++ b/slapos/entry.py
-@@ -30,19 +30,26 @@
- import ConfigParser
- import os
- import sys
--from slapos.bang import main as bang
- from slapos.client import slapconsole as console
- from slapos.client import request as request
- from slapos.client import remove as remove
- from slapos.client import supply as supply
--from slapos.format import main as format
- from slapos.cache import cache_lookup
--from slapos.grid.slapgrid import runComputerPartition as instance
--from slapos.grid.slapgrid import runSoftwareRelease as software
--from slapos.grid.slapgrid import runUsageReport as report
--from slapos.grid.svcbackend import supervisord
--from slapos.grid.svcbackend import supervisorctl
--from slapos.register.register import main as register
+--- a/slapos/cli/entry.py
++++ b/slapos/cli/entry.py
+@@ -44,7 +44,15 @@
+             name = '%s %s' % (name, next_val) if name else next_val
+             if name in self.commands:
+                 cmd_ep = self.commands[name]
+-                cmd_factory = cmd_ep.load()
++                try:
++                    cmd_factory = cmd_ep.load()
++                except ImportError:
++                    LOG.critical("slapos: the command %r is not available "
++                                 "because 'slapos-node-unofficial' package is not installed.",
++                                 ' '.join(argv))
 +
-+try:
-+  from slapos.bang import main as bang
-+  from slapos.format import main as format
-+  from slapos.grid.slapgrid import runComputerPartition as instance
-+  from slapos.grid.slapgrid import runSoftwareRelease as software
-+  from slapos.grid.slapgrid import runUsageReport as report
-+  from slapos.grid.svcbackend import supervisord
-+  from slapos.grid.svcbackend import supervisorctl
-+  from slapos.register.register import main as register
-+except ImportError:
-+  SLAPOS_CLIENT_ONLY = True
-+else:
-+  SLAPOS_CLIENT_ONLY = False
++                    sys.exit(5)
 +
- from slapos.version import version
+                 return (cmd_factory, name, search_args)
+         else:
+             LOG.critical('slapos: the command %r does not exist or is not yet implemented.\n'
+@@ -70,8 +78,15 @@
+         command_manager = app.command_manager
+         groups = collections.defaultdict(list)
+         for name, ep in sorted(command_manager):
+-            command_group, help_line = self._help_line(ep, name)
+-            groups[command_group].append(help_line)
++            try:
++                factory = ep.load()
++                cmd = factory(self, None)
++            except ImportError:
++                continue
++
++            one_liner = cmd.get_description().split('\n')[0]
++            group = getattr(factory, 'command_group', 'other')
++            groups[group].append('  %-13s  %s\n' % (name, one_liner))
  
- # Note: this whole file is a hack. We should better try dedicated library
-@@ -170,7 +177,7 @@
-   module responsible of the operation.
-   """
-   # If "node" arg is the first: we strip it and set a switch
--  if len(sys.argv) > 1 and sys.argv[1] == "node":
-+  if len(sys.argv) > 1 and sys.argv[1] == "node" and not SLAPOS_CLIENT_ONLY:
-     sys.argv.pop(1)
-     # Hackish way to show status if no argument is specified
-     if len(sys.argv) is 1:
-@@ -181,12 +188,24 @@
+         for group in sorted(groups):
+             app.stdout.write('\n%s commands:\n' % group)
+@@ -79,20 +94,6 @@
+                 app.stdout.write(line)
+         sys.exit(0)
  
-   usage = """SlapOS %s command line interface.
- For more informations, refer to SlapOS documentation.
-+""" % version
+-    def _help_line(self, ep, name):
+-        try:
+-            factory = ep.load()
+-        except Exception as err:
+-            return 'Could not load %r\n' % ep
+-        try:
+-            cmd = factory(self, None)
+-        except Exception as err:
+-            return 'Could not instantiate %r: %s\n' % (ep, err)
+-        one_liner = cmd.get_description().split('\n')[0]
+-        group = getattr(factory, 'command_group', 'other')
+-        return group, '  %-13s  %s\n' % (name, one_liner)
+-
+-
+ class SlapOSApp(cliff.app.App):
  
-+  if SLAPOS_CLIENT_ONLY:
-+    usage += """
-+*****IMPORTANT NOTE*****: "node" subcommands are not available because
-+"slapos-node-unofficial" Debian package is not installed.
-+"""
-+
-+  usage += """
- Client subcommands usage:
-   slapos request <instance-name> <software-url> [--configuration arg1=value1 arg2=value2 ... argN=valueN]
-   slapos supply <software-url> <node-id>
-   slapos console
-   slapos cache-lookup <software-url-or-md5>
-+"""
-+
-+  if not SLAPOS_CLIENT_ONLY:
-+    usage += """
- Node subcommands usage:
-   slapos node
-   slapos node register <node-id>
-@@ -201,7 +220,7 @@
-   slapos node status <process>
-   slapos node supervisorctl
-   slapos node supervisord
--""" % version
-+"""
- 
-   # Parse arguments
-   # XXX remove the "positional arguments" from help message
+     #

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	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch	2014-01-30 09:54:33 UTC (rev 10441)
@@ -6,289 +6,52 @@
  on /etc/slapos/slapos-client.cfg and /etc/slapos/slapos-node-unofficial.cfg
  generated upon package installation.
 
-Index: slapos.core-0.35.1/slapos/format.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/format.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/format.py	2013-02-28 19:46:01.524762410 +0900
-@@ -960,8 +960,10 @@
-     else:
-       (options, args) = self.parse_args()
-     if len(args) != 1:
--      self.error("Incorrect number of arguments")
--    return options, args[0]
-+      configuration_file = '/etc/slapos/slapos-node-unofficial.cfg'
-+    else:
-+      configuration_file = args[0]
-+    return options, configuration_file
+--- a/slapos/cli/config.py
++++ b/slapos/cli/config.py
+@@ -18,7 +18,7 @@
+     default_config_var = 'SLAPOS_CONFIGURATION'
  
+     # use this if default_config_var does not exist
+-    default_config_path = '/etc/opt/slapos/slapos.cfg'
++    default_config_path = ('/etc/slapos/slapos-node-unofficial.cfg',)
  
- 
-@@ -1326,7 +1328,11 @@
-   "Run default configuration."
- 
-   # Parse arguments
--  usage = "usage: %s [options] CONFIGURATION_FILE" % sys.argv[0]
-+  usage = """usage: %s [options] CONFIGURATION_FILE
+     def get_parser(self, prog_name):
+         ap = super(ConfigCommand, self).get_parser(prog_name)
+@@ -32,8 +32,17 @@
+         if args.cfg:
+             cfg_path = args.cfg
+         else:
+-            cfg_path = os.environ.get(self.default_config_var, self.default_config_path)
+-        return os.path.expanduser(cfg_path)
++            cfg_path = os.environ.get(self.default_config_var,
++                                      self.default_config_path)
 +
-+If CONFIGURATION_FILE is not given explicitly, it fallbacks on
-+`/etc/slapos/slapos-node-unofficial.cfg'.
-+""" % sys.argv[0]
-   options, configuration_file_path = Parser(usage=usage).check_args(args)
-   config = Config()
-   try:
-Index: slapos.core-0.35.1/slapos/grid/slapgrid.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/grid/slapgrid.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/grid/slapgrid.py	2013-02-28 19:46:01.528762453 +0900
-@@ -145,8 +145,9 @@
-            "(ie.:slappartX, slappartY),"
-            "this option will make all others computer partitions be ignored.")
- 
--  parser.add_argument("configuration_file", nargs=1, type=argparse.FileType(),
--      help="SlapOS configuration file.")
-+  parser.add_argument("configuration_file", nargs='?', type=argparse.FileType(),
-+      help="SlapOS configuration file.",
-+      default='/etc/slapos/slapos-node-unofficial.cfg')
- 
-   # Deprecated options
-   parser.add_argument("--develop", action="store_true", default=False,
-@@ -168,7 +169,7 @@
-       parser.parse_args(list(argument_tuple))
-   # Parses arguments from config file, if needed, then merge previous arguments
-   option_dict = {}
--  configuration_file = argument_option_instance.configuration_file[0]
-+  configuration_file = argument_option_instance.configuration_file
-   # Loads config (if config specified)
-   slapgrid_configuration = ConfigParser.SafeConfigParser()
-   slapgrid_configuration.readfp(configuration_file)
-Index: slapos.core-0.35.1/slapos/proxy/__init__.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/proxy/__init__.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/proxy/__init__.py	2013-02-28 19:46:01.528762453 +0900
-@@ -67,9 +67,11 @@
-     """
-     (options, args) = self.parse_args()
-     if len(args) != 1:
--      self.error("Incorrect number of arguments")
-+      configuration_filename = '/etc/slapos/slapos-node-unofficial.cfg'
-+    else:
-+      configuration_filename = args[0]
- 
--    return options, args[0]
-+    return options, configuration_filename
- 
- class Config:
-   def setConfig(self, option_dict, configuration_file_path):
-Index: slapos.core-0.35.1/slapos/grid/svcbackend.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/grid/svcbackend.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/grid/svcbackend.py	2013-02-28 19:46:01.528762453 +0900
-@@ -127,6 +127,8 @@
- Typical usage:
-  * %prog CONFIGURATION_FILE [arguments passed to supervisor]
- 
-+If CONFIGURATION_FILE is not given explicitly, it fallbacks on
-+`/etc/slapos/slapos-node-unofficial.cfg'.
- """.strip()
- 
-   parser = OptionParser(usage=usage)
-@@ -138,12 +140,12 @@
-     # No arguments given to entry point : we parse sys.argv.
-     (argument_option_instance, argument_list) = parser.parse_args()
- 
--  if not argument_list:
--    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 argument_list and os.path.exists(argument_list[0]):
-+    configuration_file = argument_list.pop(0)
-+  else:
-+    configuration_file = '/etc/slapos/slapos-node-unofficial.cfg'
-+    if not os.path.exists(configuration_file):
-+      parser.error("Could not read configuration file: %s" % configuration_file)
- 
-   slapgrid_configuration = ConfigParser.SafeConfigParser()
-   slapgrid_configuration.read(configuration_file)
-@@ -156,7 +158,7 @@
-   # Supervisord socket
-   option_dict.setdefault('supervisord_socket',
-                          os.path.join(option_dict['instance_root'], 'supervisord.socket'))
--  return option_dict, argument_list[1:]
-+  return option_dict, argument_list
- 
- 
- def supervisorctl(*argument_tuple):
-Index: slapos.core-0.35.1/slapos/bang.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/bang.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/bang.py	2013-02-28 19:46:01.528762453 +0900
-@@ -34,13 +34,14 @@
- def main(*args):
-   parser = argparse.ArgumentParser()
-   parser.add_argument("-m", "--message", default='', help="Message for bang.")
--  parser.add_argument("configuration_file", nargs=1, type=argparse.FileType(),
-+  parser.add_argument("configuration_file", nargs='?', type=argparse.FileType(),
-+      default='/etc/slapos/slapos-node-unofficial.cfg',
-       help="SlapOS configuration file.")
-   if len(args) == 0:
-     argument = parser.parse_args()
-   else:
-     argument = parser.parse_args(list(args))
--  configuration_file = argument.configuration_file[0]
-+  configuration_file = argument.configuration_file
-   message = argument.message
-   # Loads config (if config specified)
-   configuration = ConfigParser.SafeConfigParser()
-Index: slapos.core-0.35.1/slapos/client.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/client.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/client.py	2013-02-28 19:46:01.528762453 +0900
-@@ -64,12 +64,15 @@
-     """
-     (options, args) = self.parse_args()
-     if len(args) == 0:
--      self.error("Incorrect number of arguments")
--    elif not os.path.isfile(args[0]):
--      self.error("%s: Not found or not a regular file." % args[0])
-+      configuration_file_path = '/etc/slapos/slapos-client.cfg'
-+    else:
-+      configuration_file_path = args[0]
++        cfg_path_tuple = isinstance(cfg_path, tuple) and cfg_path or (cfg_path,)
++        for path in cfg_path_tuple:
++            path = os.path.expanduser(path)
++            if os.path.exists(path):
++                return path
 +
-+    if not os.path.isfile(configuration_file_path):
-+      self.error("%s: Not found or not a regular file." % configuration_file_path)
++        raise ConfigError('Cannot find configuration file(s): %s' %
++                          ', '.join(cfg_path_tuple))
  
--    # Return options and only first element of args since there is only one.
--    return options, args[0]
-+    # Return options and configuration file path
-+    return options, configuration_file_path
- 
- 
- def argToDict(element):
-@@ -86,6 +89,8 @@
-   """
-   parser = argparse.ArgumentParser()
-   parser.add_argument("configuration_file",
-+                      nargs='?',
-+                      default='/etc/slapos/slapos-client.cfg',
-                       help="SlapOS configuration file.")
-   parser.add_argument("reference",
-                       help="Your instance reference")
-@@ -124,13 +129,17 @@
-       setattr(self, option, value)
- 
-     # Load configuration file
--    configuration_parser = ConfigParser.SafeConfigParser()
-     if configuration_file_path:
-       configuration_file_path = os.path.expanduser(configuration_file_path)
--      if not os.path.isfile(configuration_file_path):
--        raise OSError('Specified configuration file %s does not exist.'
--            ' Exiting.' % configuration_file_path)
--      configuration_parser.read(configuration_file_path)
-+    else:
-+      configuration_file_path = '/etc/slapos/slapos-client.cfg'
-+
-+    if not os.path.isfile(configuration_file_path):
-+      raise OSError('Specified configuration file %s does not exist.'
-+                    ' Exiting.' % configuration_file_path)
-+
-+    configuration_parser = ConfigParser.SafeConfigParser()
-+    configuration_parser.read(configuration_file_path)
-     # Merges the arguments and configuration
-     try:
-       configuration_dict = dict(configuration_parser.items('slapconsole'))
-@@ -249,6 +258,8 @@
-   # XXX-Cedric: move argument parsing to main entry point
-   parser = argparse.ArgumentParser()
-   parser.add_argument("configuration_file",
-+                      nargs='?',
-+                      default='/etc/slapos/slapos-client.cfg',
-                       help="SlapOS configuration file")
-   parser.add_argument("software_url",
-                       help="Your software url")
-@@ -266,6 +277,8 @@
-   # XXX-Cedric: move argument parsing to main entry point
-   parser = argparse.ArgumentParser()
-   parser.add_argument("configuration_file",
-+                      nargs='?',
-+                      default='/etc/slapos/slapos-client.cfg',
-                       help="SlapOS configuration file.")
-   parser.add_argument("software_url",
-                       help="Your software url")
-@@ -284,6 +297,9 @@
- slapconsole allows you interact with slap API. You can play with the global
- "slap" object and with the global "request" method.
- 
-++If CONFIGURATION_FILE is not given explicitly, it fallbacks on
-+`/etc/slapos/slapos-client.cfg'.
-+
- examples :
-   >>> # Request instance
-   >>> request(kvm, "myuniquekvm")
-Index: slapos.core-0.35.1/slapos/entry.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/entry.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/entry.py	2013-02-28 19:46:01.528762453 +0900
-@@ -50,11 +50,15 @@
- 
- GLOBAL_SLAPOS_CONFIGURATION = os.environ.get(
-     'SLAPOS_CONFIGURATION',
--    '/etc/opt/slapos/slapos.cfg')
-+    '/etc/slapos/slapos-node-unofficial.cfg')
-+
- USER_SLAPOS_CONFIGURATION = os.environ.get(
-     'SLAPOS_CLIENT_CONFIGURATION',
-     os.environ.get('SLAPOS_CONFIGURATION', '~/.slapos/slapos.cfg'))
- 
-+if not os.path.exists(USER_SLAPOS_CONFIGURATION):
-+  USER_SLAPOS_CONFIGURATION = GLOBAL_SLAPOS_CONFIGURATION
-+
- class EntryPointNotImplementedError(NotImplementedError):
-   def __init__(self, *args, **kw_args):
-     NotImplementedError.__init__(self, *args, **kw_args)
-Index: slapos.core-0.35.1/slapos/cache.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/cache.py	2013-02-28 19:46:01.532762494 +0900
-+++ slapos.core-0.35.1/slapos/cache.py	2013-02-28 19:46:01.528762453 +0900
-@@ -18,7 +18,10 @@
- 
- def cache_lookup():
-     parser = argparse.ArgumentParser()
--    parser.add_argument("configuration_file", help="SlapOS configuration file")
-+    parser.add_argument(
-+        "configuration_file",
-+        help="SlapOS configuration file (by default: ~/.slapos/slapos.cfg "
-+             "then /etc/slapos/slapos-client.cfg)")
-     parser.add_argument("software_url", help="Your software url or MD5 hash")
-     args = parser.parse_args()
- 
-Index: slapos.core-0.35.1/slapos/proxy/query.py
-===================================================================
---- slapos.core-0.35.1.orig/slapos/proxy/query.py	2013-02-08 18:25:46.000000000 +0900
-+++ slapos.core-0.35.1/slapos/proxy/query.py	2013-02-28 19:50:59.527916050 +0900
-@@ -50,8 +50,9 @@
-         Check arguments
+     def fetch_config(self, args):
          """
-         (options, args) = self.parse_args()
--        if len(args) < 1:
--            self.error("Incorrect number of arguments")
-+        args_len = len(args)
-+        if args_len < 1:
-+          return options, '/etc/slapos/slapos-node-unofficial.cfg'
+@@ -47,9 +56,6 @@
  
-         return options, args[0]
+         self.app.log.debug('Loading config: %s', cfg_path)
  
-@@ -228,7 +229,11 @@
+-        if not os.path.exists(cfg_path):
+-            raise ConfigError('Configuration file does not exist: %s' % cfg_path)
+-
+         configp = ConfigParser.SafeConfigParser()
+         if configp.read(cfg_path) != [cfg_path]:
+             # bad permission, etc.
+@@ -64,5 +70,6 @@
+     """
  
- def main():
-   "Run default configuration."
--  usage = "usage: %s [options] CONFIGURATION_FILE" % sys.argv[0]
-+  usage = """usage: %s [options] CONFIGURATION_FILE
-+
-+If CONFIGURATION_FILE is not given explicitly, it fallbacks on
-+`/etc/slapos/slapos-node-unofficial.cfg'.
-+""" % sys.argv[0]
- 
-   try:
-     # Parse arguments
+     default_config_var = 'SLAPOS_CLIENT_CONFIGURATION'
+-    default_config_path = '~/.slapos/slapos-client.cfg'
++    default_config_path = ('~/.slapos/slapos-client.cfg',
++                           '/etc/slapos/slapos-client.cfg')
+     command_group = 'client'

Modified: packages/slapos.core/trunk/debian/slapos-client.install
===================================================================
--- packages/slapos.core/trunk/debian/slapos-client.install	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/slapos-client.install	2014-01-30 09:54:33 UTC (rev 10441)
@@ -1,15 +1,26 @@
 usr/lib/python2.*/dist-packages/slapos.core*.egg-info/
-usr/lib/python2.*/dist-packages/slapos/entry.py
+usr/lib/python2.*/dist-packages/slapos/slap/
+usr/lib/python2.*/dist-packages/slapos/cli/__init__.py
+usr/lib/python2.*/dist-packages/slapos/cli/command.py
+usr/lib/python2.*/dist-packages/slapos/cli/config.py
+usr/lib/python2.*/dist-packages/slapos/cli/entry.py
+usr/lib/python2.*/dist-packages/slapos/cli/console.py
+usr/lib/python2.*/dist-packages/slapos/cli/remove.py
+usr/lib/python2.*/dist-packages/slapos/cli/supply.py
+usr/lib/python2.*/dist-packages/slapos/cli/request.py
 usr/lib/python2.*/dist-packages/slapos/client.py
-usr/lib/python2.*/dist-packages/slapos/util.py
 usr/lib/python2.*/dist-packages/slapos/version.py
-usr/lib/python2.*/dist-packages/slapos/cache.py
 usr/lib/python2.*/dist-packages/slapos/slapos.xsd
-usr/lib/python2.*/dist-packages/slapos/slap/
 usr/lib/python2.*/dist-packages/slapos/tests/__init__.py
+usr/lib/python2.*/dist-packages/slapos/tests/slapmock/
 usr/lib/python2.*/dist-packages/slapos/tests/slap.py
+usr/lib/python2.*/dist-packages/slapos/tests/client.py
 usr/lib/python2.*/dist-packages/slapos/tests/interface.py
 usr/lib/python2.*/dist-packages/slapos.core-*-nspkg.pth
-usr/bin/slapconsole
 usr/bin/slapos
-debian/conf/slapos-client.cfg					usr/share/slapos-client
\ No newline at end of file
+debian/conf/slapos-client.cfg					usr/share/slapos-client
+## Deprecated commands in favor of an unique command (slapos)
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/__init__.py
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/util.py
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/console.py
+#usr/bin/slapconsole

Modified: packages/slapos.core/trunk/debian/slapos-node-unofficial.install
===================================================================
--- packages/slapos.core/trunk/debian/slapos-node-unofficial.install	2014-01-30 08:43:47 UTC (rev 10440)
+++ packages/slapos.core/trunk/debian/slapos-node-unofficial.install	2014-01-30 09:54:33 UTC (rev 10441)
@@ -1,24 +1,37 @@
-usr/lib/python2.*/dist-packages/slapos/register
 usr/lib/python2.*/dist-packages/slapos/proxy
 usr/lib/python2.*/dist-packages/slapos/bang.py
-usr/lib/python2.*/dist-packages/slapos/tests/entry.py
+usr/lib/python2.*/dist-packages/slapos/format.py
+usr/lib/python2.*/dist-packages/slapos/grid
+usr/lib/python2.*/dist-packages/slapos/cli/supervisord.py
+usr/lib/python2.*/dist-packages/slapos/cli/slapgrid.py
+usr/lib/python2.*/dist-packages/slapos/cli/bang.py
+usr/lib/python2.*/dist-packages/slapos/cli/supervisorctl.py
+usr/lib/python2.*/dist-packages/slapos/cli/proxy_show.py
+usr/lib/python2.*/dist-packages/slapos/cli/format.py
+usr/lib/python2.*/dist-packages/slapos/cli/proxy_start.py
+usr/lib/python2.*/dist-packages/slapos/cli/cache.py
+usr/lib/python2.*/dist-packages/slapos/util.py
+usr/lib/python2.*/dist-packages/slapos/tests/cli.py
+usr/lib/python2.*/dist-packages/slapos/tests/slapproxy.py
 usr/lib/python2.*/dist-packages/slapos/tests/slapgrid.py
-usr/lib/python2.*/dist-packages/slapos/tests/mock
-usr/lib/python2.*/dist-packages/slapos/tests/pyflakes
+usr/lib/python2.*/dist-packages/slapos/tests/slapformat.py
+usr/lib/python2.*/dist-packages/slapos/tests/distribution.py
+usr/lib/python2.*/dist-packages/slapos/tests/util.py
 usr/lib/python2.*/dist-packages/slapos/tests/slapobject.py
-usr/lib/python2.*/dist-packages/slapos/tests/slapproxy.py
-usr/lib/python2.*/dist-packages/slapos/tests/slapformat.py
-usr/lib/python2.*/dist-packages/slapos/format.py
-usr/lib/python2.*/dist-packages/slapos/grid
 usr/bin/slapos-watchdog                                         usr/sbin
-usr/bin/slapformat                                              usr/sbin
-usr/bin/slapgrid-supervisorctl                                  usr/sbin
-usr/bin/slapgrid-supervisord                                    usr/sbin
-usr/bin/slapproxy                                               usr/sbin
-usr/bin/slapproxy-query						usr/bin
-usr/bin/slapgrid-sr                                             usr/sbin
 usr/bin/bang                                                    usr/sbin
-usr/bin/slapgrid                                                usr/sbin
-usr/bin/slapgrid-ur                                             usr/sbin
-usr/bin/slapgrid-cp                                             usr/sbin
 debian/conf/slapos-node-unofficial.cfg				usr/share/slapos-node-unofficial
+## Deprecated commands in favor of an unique command (slapos)
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/slapgrid.py
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/bang.py
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/svcbackend.py
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/format.py
+#usr/lib/python2.*/dist-packages/slapos/cli_legacy/proxy_start.py
+#usr/bin/slapgrid                                                usr/sbin
+#usr/bin/slapgrid-ur                                             usr/sbin
+#usr/bin/slapgrid-cp                                             usr/sbin
+#usr/bin/slapformat                                              usr/sbin
+#usr/bin/slapgrid-supervisorctl                                  usr/sbin
+#usr/bin/slapgrid-supervisord                                    usr/sbin
+#usr/bin/slapproxy                                               usr/sbin
+#usr/bin/slapgrid-sr                                             usr/sbin




More information about the Python-apps-commits mailing list