Example #1
0
 def update_manifest(self, build_id=None):
     self.manifest = schemas.create_unordered_dict_from_schema(
         schemas.get_schema('manifest_yaml_schema', 'artiball'), 'manifest', 'artiball')
     if build_id:
         self.manifest['metadata']['build_id'] = build_id
     for file in self.yaml_files:
         if 'main_deployment' in file:
             with open(file, 'r') as temp_file:
                 try:
                     deployment_data = yaml.load(temp_file)
                 except yaml.scanner.ScannerError:
                     self.logger.write("Invalid yaml syntax  " + file + '\n', multi_line=True)
                     sys.exit(1)
                 schemas.set_indicators()
                 if deployment_data['definition']['service_name'] not in schemas.INDICATORS:
                     self.manifest['metadata']['app_name'] = deployment_data['definition']['service_name']
                 if deployment_data['definition']['version'] not in schemas.INDICATORS:
                     self.manifest['metadata']['app_version'] = deployment_data['definition']['version']
                 if deployment_data['definition']['chef_type'] == 'server':
                     with open(os.path.join(self.base_dir, 'skybase.yaml'), 'r') as config_file:
                         try:
                             skybase_data = yaml.load(config_file)
                         except yaml.scanner.ScannerError:
                             self.logger.write("Invalid yaml syntax  " + file + '\n', multi_line=True)
                             sys.exit(1)
                         schemas.set_indicators()
                         for installation in skybase_data['packing']['installations']:
                             if installation.get("chef"):
                                 if (installation['chef']['repository_url'] not in schemas.INDICATORS) and \
                                         (installation['chef']['repository_branch'] not in schemas.INDICATORS):
                                     self.manifest['chef_cookbook_source'] = installation['chef']['repository_url'] + \
                                                                             '=' + installation['chef']['repository_branch']
                     config_file.close()
             temp_file.close()
Example #2
0
 def update_manifest(self, build_id=None):
     self.manifest = schemas.create_unordered_dict_from_schema(
         schemas.get_schema('manifest_yaml_schema', 'artiball'), 'manifest',
         'artiball')
     if build_id:
         self.manifest['metadata']['build_id'] = build_id
     for file in self.yaml_files:
         if 'main_deployment' in file:
             with open(file, 'r') as temp_file:
                 try:
                     deployment_data = yaml.load(temp_file)
                 except yaml.scanner.ScannerError:
                     self.logger.write("Invalid yaml syntax  " + file +
                                       '\n',
                                       multi_line=True)
                     sys.exit(1)
                 schemas.set_indicators()
                 if deployment_data['definition'][
                         'service_name'] not in schemas.INDICATORS:
                     self.manifest['metadata'][
                         'app_name'] = deployment_data['definition'][
                             'service_name']
                 if deployment_data['definition'][
                         'version'] not in schemas.INDICATORS:
                     self.manifest['metadata'][
                         'app_version'] = deployment_data['definition'][
                             'version']
                 if deployment_data['definition']['chef_type'] == 'server':
                     with open(os.path.join(self.base_dir, 'skybase.yaml'),
                               'r') as config_file:
                         try:
                             skybase_data = yaml.load(config_file)
                         except yaml.scanner.ScannerError:
                             self.logger.write("Invalid yaml syntax  " +
                                               file + '\n',
                                               multi_line=True)
                             sys.exit(1)
                         schemas.set_indicators()
                         for installation in skybase_data['packing'][
                                 'installations']:
                             if installation.get("chef"):
                                 if (installation['chef']['repository_url'] not in schemas.INDICATORS) and \
                                         (installation['chef']['repository_branch'] not in schemas.INDICATORS):
                                     self.manifest['chef_cookbook_source'] = installation['chef']['repository_url'] + \
                                                                             '=' + installation['chef']['repository_branch']
                     config_file.close()
             temp_file.close()
Example #3
0
from skybase import schemas

schemas.set_indicators()

#Directory schemas layout of the directories
artiball_schema = [
    [[''],['skybase.yaml']],
    # [['app'], []],
    [['app_config'], ['main_app_config.yaml']],
    [['installation'], []],
    [['installation', 'chef', 'cookbooks'], []],
    [['installation', 'chef', 'databags'], []],
    [['installation', 'chef', 'encrypted_databags'], []],
    [['deployment'], []],
    [['deployment'], ['main_deployment.yaml']],
]

# TODO: move/derive these from artiball schema module
ARTIBALL_SCHEMA_ARGS = {
    'code_dir': 'app',

    'config_dir': 'app_config',
    'config_file': 'main_app_config.yaml',

    'deploy_dir': 'deployment',
    'deploy_file': 'main_deployment.yaml',

    'cookbooks_dir': 'installation/chef/cookbooks',
    'cookbooks_order_file': 'installation/chef/cookbook-order.yaml',
    'encrypted_data_bag_secret': 'chef/COMMON/encrypted_data_bag_secret',
    'databags_dir': 'installation/chef/databags',