Beispiel #1
0
def voodoo_load_yaml(file_name):
    try:
        # Load default voodoo config
        default_config_path = os.path.join(os.path.expanduser("~"), '.voodoo',
                                           'config.yml')
        with open(default_config_path, 'r') as fh:
            voodoo_config = yaml.safe_load(fh)

        with open(file_name, 'r') as fh:
            #Load custom config
            config = yaml.safe_load(fh)

            #update voodoo config
            voodoo_config.update(config.pop('voodoo', {}))

            # share .voodoo folder in voodoo
            home = os.path.expanduser("~")
            shared = os.path.join(home, '.voodoo', 'shared')
            config['odoo']['volumes'].append('%s:%s' % (shared, shared))

            # Add gitconfig in voodoo
            if 'gitconfig' in voodoo_config:
                gitconfig = os.path.expanduser(voodoo_config['gitconfig'])
                config['odoo']['volumes'].append(
                    '%s:/home/devstep/.gitconfig' % (gitconfig))

            #Add environment variable
            config['odoo']['environment'] += [
                'SHARED_FOLDER=%s' % shared,
                'SHARED_EGGS=%s' % str(voodoo_config['shared_eggs']).lower(),
            ]
            return config
    except IOError as e:
        raise UserError(six.text_type(e))
Beispiel #2
0
def voodoo_load_yaml(file_name):
    try:
        # Load default voodoo config
        default_config_path = os.path.join(
            os.path.expanduser("~"), '.voodoo', 'config.yml')
        with open(default_config_path, 'r') as fh:
            voodoo_config = yaml.safe_load(fh)

        with open(file_name, 'r') as fh:
            #Load custom config
            config = yaml.safe_load(fh)

            #update voodoo config
            voodoo_config.update(config.pop('voodoo', {}))

            # share .voodoo folder in voodoo
            home = os.path.expanduser("~")
            shared = os.path.join(home, '.voodoo', 'shared')
            config['odoo']['volumes'].append('%s:%s' % (shared, shared))

            # Add gitconfig in voodoo
            if 'gitconfig' in voodoo_config:
                gitconfig = os.path.expanduser(voodoo_config['gitconfig'])
                config['odoo']['volumes'].append(
                    '%s:/home/devstep/.gitconfig' % (gitconfig))

            #Add environment variable
            config['odoo']['environment'] += [
                'SHARED_FOLDER=%s' % shared,
                'SHARED_EGGS=%s' % str(voodoo_config['shared_eggs']).lower(),
                ]
            return config
    except IOError as e:
            raise UserError(six.text_type(e))
Beispiel #3
0
 def load_project_config(self, options):
     explicit_config_path = options.get('--file')\
         or os.environ.get('COMPOSE_FILE')\
         or os.environ.get('FIG_FILE')
     config_path = self.get_config_path(file_path=explicit_config_path)
     try:
         with open(config_path, 'r') as fh:
             config = yaml.safe_load(fh)
             voodoo_config = config.pop('voodoo', {})
             self.set_config(voodoo_config)
     except IOError as e:
         raise UserError(six.text_type(e))
Beispiel #4
0
 def load_project_config(self, options):
     explicit_config_path = options.get('--file')\
         or os.environ.get('COMPOSE_FILE')\
         or os.environ.get('FIG_FILE')
     config_path = self.get_config_path(file_path=explicit_config_path)
     try:
         with open(config_path, 'r') as fh:
             config = yaml.safe_load(fh)
             voodoo_config = config.pop('voodoo', {})
             self.set_config(voodoo_config)
     except IOError as e:
         raise UserError(six.text_type(e))