[Python-apps-commits] r10552 - in packages/slapos.core/trunk/debian (3 files)
arnau at users.alioth.debian.org
arnau at users.alioth.debian.org
Fri Feb 21 11:56:02 UTC 2014
Date: Friday, February 21, 2014 @ 11:56:01
Author: arnau
Revision: 10552
Add cli/register.py to allow registering a node to the master.
Modified:
packages/slapos.core/trunk/debian/changelog
packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch
packages/slapos.core/trunk/debian/slapos-node-unofficial.install
Modified: packages/slapos.core/trunk/debian/changelog
===================================================================
--- packages/slapos.core/trunk/debian/changelog 2014-02-20 09:54:25 UTC (rev 10551)
+++ packages/slapos.core/trunk/debian/changelog 2014-02-21 11:56:01 UTC (rev 10552)
@@ -1,3 +1,12 @@
+slapos.core (1.0.2.1-4) UNRELEASED; urgency=medium
+
+ * Add cli/register.py to allow registering a node to the master.
+ + debian/slapos-node-unofficial.install: Added.
+ + debian/patches/system_configuration_file_by_default.patch:
+ - Fix paths statically set to use system-wide ones.
+
+ -- Arnaud Fontaine <arnau at debian.org> Fri, 21 Feb 2014 19:36:47 +0900
+
slapos.core (1.0.2.1-3) unstable; urgency=medium
* debian/conf/slapos-node-unofficial.cfg:
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-02-20 09:54:25 UTC (rev 10551)
+++ packages/slapos.core/trunk/debian/patches/system_configuration_file_by_default.patch 2014-02-21 11:56:01 UTC (rev 10552)
@@ -55,3 +55,91 @@
+ default_config_path = ('~/.slapos/slapos-client.cfg',
+ '/etc/slapos/slapos-client.cfg')
command_group = 'client'
+--- a/slapos/cli/register.py
++++ b/slapos/cli/register.py
+@@ -156,8 +156,8 @@
+
+ def save_former_config(conf):
+ """Save former configuration if found"""
+- former = '/etc/opt/slapos'
+- if not os.path.exists(os.path.join(former, 'slapos.cfg')):
++ former = '/etc/slapos'
++ if not os.path.exists(os.path.join(former, 'slapos-node-unofficial.cfg')):
+ return
+
+ saved = former + '.old'
+@@ -174,13 +174,11 @@
+
+
+ def fetch_configuration_template():
+- req = requests.get('http://git.erp5.org/gitweb/slapos.core.git/blob_plain/HEAD:/slapos.cfg.example')
+- req.raise_for_status()
+- return req.text
++ return open('/etc/slapos/slapos-node-unofficial.cfg').read().decode('utf-8')
+
+
+ def slapconfig(conf):
+- """Base Function to configure slapos in /etc/opt/slapos"""
++ """Base Function to configure slapos in /etc/slapos"""
+ dry_run = conf.dry_run
+ # Create slapos configuration directory if needed
+ slap_conf_dir = os.path.normpath(conf.slapos_configuration)
+@@ -213,8 +211,8 @@
+ if not dry_run:
+ os.mkdir(user_certificate_repository_path, 0o711)
+
+- key_file = os.path.join(user_certificate_repository_path, 'key')
+- cert_file = os.path.join(user_certificate_repository_path, 'certificate')
++ key_file = os.path.join(user_certificate_repository_path, 'slapos.key')
++ cert_file = os.path.join(user_certificate_repository_path, 'slapos.crt')
+
+ for src, dst in [(conf.key, key_file), (conf.certificate, cert_file)]:
+ conf.logger.info('Copying to %r, and setting minimum privileges', dst)
+@@ -224,16 +222,14 @@
+ os.chmod(dst, 0o600)
+ os.chown(dst, 0, 0)
+
+- certificate_repository_path = os.path.join(slap_conf_dir, 'ssl', 'partition_pki')
++ certificate_repository_path = '/var/cache/slapos/certificates'
+ if not os.path.exists(certificate_repository_path):
+ conf.logger.info('Creating directory: %s', certificate_repository_path)
+ if not dry_run:
+ os.mkdir(certificate_repository_path, 0o711)
+
+ # Put slapos configuration file
+- config_path = os.path.join(slap_conf_dir, 'slapos.cfg')
+-
+- # XXX: We should actually get the template from the egg, not from git
++ config_path = os.path.join(slap_conf_dir, 'slapos-node-unofficial.cfg')
+ cfg = fetch_configuration_template()
+
+ to_replace = [
+@@ -304,7 +300,7 @@
+
+
+ def do_register(conf):
+- """Register new computer on SlapOS Master and generate slapos.cfg"""
++ """Register new computer on SlapOS Master and generate slapos-node-unofficial.cfg"""
+
+ if conf.login or conf.login_auth:
+ for login, password in gen_auth(conf):
+@@ -332,17 +328,14 @@
+ COMP = get_computer_name(certificate)
+
+ # Getting configuration parameters
+- conf.COMPConfig(slapos_configuration='/etc/opt/slapos/',
++ conf.COMPConfig(slapos_configuration='/etc/slapos/',
+ computer_id=COMP,
+ certificate=certificate,
+ key=key)
+
+- # Save former configuration
+- if not conf.dry_run:
+- save_former_config(conf)
+ # Prepare Slapos Configuration
+ slapconfig(conf)
+
+ conf.logger.info('Node has successfully been configured as %s.', COMP)
+- conf.logger.info('Now please invoke /usr/sbin/slapos-start on your site.')
++ conf.logger.info('Now please invoke /usr/bin/slapos node start on your site.')
+ return 0
Modified: packages/slapos.core/trunk/debian/slapos-node-unofficial.install
===================================================================
--- packages/slapos.core/trunk/debian/slapos-node-unofficial.install 2014-02-20 09:54:25 UTC (rev 10551)
+++ packages/slapos.core/trunk/debian/slapos-node-unofficial.install 2014-02-21 11:56:01 UTC (rev 10552)
@@ -10,6 +10,7 @@
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/cli/register.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
More information about the Python-apps-commits
mailing list