Commit 3b47ba8d authored by Lucas Carvalho's avatar Lucas Carvalho

Added the params to propagate the signature files to slapos.buildout .

parent 6e030a76
...@@ -47,7 +47,8 @@ REQUIRED_COMPUTER_PARTITION_PERMISSION = '0750' ...@@ -47,7 +47,8 @@ REQUIRED_COMPUTER_PARTITION_PERMISSION = '0750'
class Software(object): class Software(object):
"""This class is responsible of installing a software release""" """This class is responsible of installing a software release"""
def __init__(self, url, software_root, console, buildout): def __init__(self, url, software_root, console, buildout,
signature_public_file, signature_private_file):
"""Initialisation of class parameters """Initialisation of class parameters
""" """
self.url = url self.url = url
...@@ -57,6 +58,8 @@ class Software(object): ...@@ -57,6 +58,8 @@ class Software(object):
self.buildout = buildout self.buildout = buildout
self.logger = logging.getLogger('BuildoutManager') self.logger = logging.getLogger('BuildoutManager')
self.console = console self.console = console
self.signature_private_file = signature_private_file
self.signature_public_file = signature_public_file
def install(self): def install(self):
""" Fetches buildout configuration from the server, run buildout with """ Fetches buildout configuration from the server, run buildout with
...@@ -79,6 +82,8 @@ class Software(object): ...@@ -79,6 +82,8 @@ class Software(object):
buildout_parameter_list = [ buildout_parameter_list = [
'buildout:extends-cache=%s' % extends_cache, 'buildout:extends-cache=%s' % extends_cache,
'buildout:directory=%s' % self.software_path, 'buildout:directory=%s' % self.software_path,
'buildout:signature_public_file=%s' % self.signature_public_file,
'buildout:signature_private_file=%s' % self.signature_private_file,
'-c', self.url] '-c', self.url]
bootstrapBuildout(self.software_path, self.buildout, bootstrapBuildout(self.software_path, self.buildout,
additional_buildout_parametr_list=buildout_parameter_list, additional_buildout_parametr_list=buildout_parameter_list,
......
...@@ -97,6 +97,8 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): ...@@ -97,6 +97,8 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
parser.add_argument("--key_file", help="SSL Authorisation key file.") parser.add_argument("--key_file", help="SSL Authorisation key file.")
parser.add_argument("--cert_file", parser.add_argument("--cert_file",
help="SSL Authorisation certificate file.") help="SSL Authorisation certificate file.")
parser.add_argument("--signature_private_file", help="Private Key File.")
parser.add_argument("--signature_public_file", help="Public Key File.")
parser.add_argument("--master_ca_file", help="Root certificate of SlapOS " parser.add_argument("--master_ca_file", help="Root certificate of SlapOS "
"master key.") "master key.")
parser.add_argument("--certificate_repository_path", parser.add_argument("--certificate_repository_path",
...@@ -164,9 +166,12 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): ...@@ -164,9 +166,12 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
key_file = option_dict.get('key_file') key_file = option_dict.get('key_file')
cert_file = option_dict.get('cert_file') cert_file = option_dict.get('cert_file')
master_ca_file = option_dict.get('master_ca_file') master_ca_file = option_dict.get('master_ca_file')
signature_private_file = option_dict.get('signature_private_file', '')
signature_public_file = option_dict.get('signature_public_file', '')
for f in [key_file, cert_file, master_ca_file]: for f in [key_file, cert_file, master_ca_file,
if f is not None: signature_private_file, signature_public_file]:
if f not in ('', None,):
if not os.path.exists(f): if not os.path.exists(f):
parser.error('File %r does not exists.' % f) parser.error('File %r does not exists.' % f)
...@@ -196,6 +201,8 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): ...@@ -196,6 +201,8 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple):
key_file=key_file, key_file=key_file,
cert_file=cert_file, cert_file=cert_file,
master_ca_file=master_ca_file, master_ca_file=master_ca_file,
signature_private_file=signature_private_file,
signature_public_file=signature_public_file,
certificate_repository_path=certificate_repository_path, certificate_repository_path=certificate_repository_path,
console=option_dict['console'], console=option_dict['console'],
buildout=option_dict.get('buildout')), buildout=option_dict.get('buildout')),
...@@ -265,6 +272,8 @@ class Slapgrid(object): ...@@ -265,6 +272,8 @@ class Slapgrid(object):
buildout, buildout,
key_file=None, key_file=None,
cert_file=None, cert_file=None,
signature_private_file=None,
signature_public_file=None,
master_ca_file=None, master_ca_file=None,
certificate_repository_path=None, certificate_repository_path=None,
console=False): console=False):
...@@ -281,6 +290,8 @@ class Slapgrid(object): ...@@ -281,6 +290,8 @@ class Slapgrid(object):
self.cert_file = cert_file self.cert_file = cert_file
self.master_ca_file = master_ca_file self.master_ca_file = master_ca_file
self.certificate_repository_path = certificate_repository_path self.certificate_repository_path = certificate_repository_path
self.signature_private_file = signature_private_file
self.signature_public_file = signature_public_file
# Configures logger # Configures logger
self.logger = logging.getLogger('Slapgrid') self.logger = logging.getLogger('Slapgrid')
# Creates objects from slap module # Creates objects from slap module
...@@ -352,7 +363,9 @@ class Slapgrid(object): ...@@ -352,7 +363,9 @@ class Slapgrid(object):
software_release.building() software_release.building()
software_release_uri = software_release.getURI() software_release_uri = software_release.getURI()
Software(url=software_release_uri, software_root=self.software_root, Software(url=software_release_uri, software_root=self.software_root,
console=self.console, buildout=self.buildout).install() console=self.console, buildout=self.buildout,
signature_private_file=self.signature_private_file,
signature_public_file=self.signature_public_file).install()
except (SystemExit, KeyboardInterrupt): except (SystemExit, KeyboardInterrupt):
exception = traceback.format_exc() exception = traceback.format_exc()
software_release.error(exception) software_release.error(exception)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment