Ejemplo n.º 1
0
def _create_sources_from_dict(source_dict, sources_config_dir):
    source_type = source_dict.get('type')
    if source_type == 'git':
        repositories = source_dict['repositories']
        if len(repositories) > 1 and 'destination_path' in source_dict:
            raise CourierException('You cannot set the same destination_path for more than 1 '
                                   'repository.')
        ssh_key_path = get_ssh_key_path(source_dict['ssh_key'], sources_config_dir)
        branch = source_dict.get('branch', 'master')
        del source_dict['repositories']
        for repo_url in repositories:
            source_dict['repository'] = repo_url
            yield git_source.GitSource(source_dict, repo_url, ssh_key_path, branch)
    elif source_type == 'hermes-directory':
        yield hermes_directory_source.HermesDirectorySource(source_dict)
    else:
        raise CourierException('Unknown source type: {source_type}'.format(**locals()))
Ejemplo n.º 2
0
def _create_sources_from_dict(source_dict, sources_config_dir):
    source_type = source_dict.get('type')
    if source_type == 'git':
        repositories = source_dict['repositories']
        if len(repositories) > 1 and 'destination_path' in source_dict:
            raise CourierException(
                'You cannot set the same destination_path for more than 1 '
                'repository.')
        ssh_key_path = get_ssh_key_path(source_dict['ssh_key'],
                                        sources_config_dir)
        branch = source_dict.get('branch', 'master')
        del source_dict['repositories']
        for repo_url in repositories:
            source_dict['repository'] = repo_url
            yield git_source.GitSource(source_dict, repo_url, ssh_key_path,
                                       branch)
    elif source_type == 'hermes-directory':
        yield hermes_directory_source.HermesDirectorySource(source_dict)
    else:
        raise CourierException(
            'Unknown source type: {source_type}'.format(**locals()))
Ejemplo n.º 3
0
 def __set_ssh_key_path(self, remote_address):
     remote_address['ssh_key_path'] = get_ssh_key_path(remote_address['key'], self.destination_config_dir)
Ejemplo n.º 4
0
 def __set_ssh_key_path(self, remote_address):
     remote_address['ssh_key_path'] = get_ssh_key_path(
         remote_address['key'], self.destination_config_dir)