~openstack-charmers-next/charms/wily/nova-cloud-controller/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/utils.py

  • Committer: Corey Bryant
  • Date: 2016-06-20 12:37:43 UTC
  • Revision ID: corey.bryant@canonical.com-20160620123743-a92ewktt5kkaru26
Add defaults for openstack-origin-git config option

openstack-origin-git currently only supports YAML that specifies
the git repositories to deploy from.

This adds support for default openstack-origin-git values. The
default values supported are: icehouse, kilo, liberty, mitaka,
and master.  For example: openstack-origin-git=master

Change-Id: I6b737272deed067c2f71dbd36b201aea884265ee

Show diffs side-by-side

added added

removed removed

Lines of Context:
725
725
requirements_dir = None
726
726
 
727
727
 
728
 
def git_default_repos(projects):
 
728
def git_default_repos(projects_yaml):
729
729
    """
730
730
    Returns default repos if a default openstack-origin-git value is specified.
731
731
    """
732
732
    service = service_name()
 
733
    core_project = service
733
734
 
734
735
    for default, branch in GIT_DEFAULT_BRANCHES.iteritems():
735
 
        if projects == default:
 
736
        if projects_yaml == default:
736
737
 
737
738
            # add the requirements repo first
738
739
            repo = {
742
743
            }
743
744
            repos = [repo]
744
745
 
745
 
            # neutron and nova charms require some additional repos
746
 
            if service == 'neutron':
747
 
                for svc in ['neutron-fwaas', 'neutron-lbaas', 'neutron-vpnaas']:
 
746
            # neutron-* and nova-* charms require some additional repos
 
747
            if service in ['neutron-api', 'neutron-gateway',
 
748
                           'neutron-openvswitch']:
 
749
                core_project = 'neutron'
 
750
                for project in ['neutron-fwaas', 'neutron-lbaas',
 
751
                                'neutron-vpnaas']:
748
752
                    repo = {
749
 
                        'name': svc,
750
 
                        'repository': GIT_DEFAULT_REPOS[svc],
 
753
                        'name': project,
 
754
                        'repository': GIT_DEFAULT_REPOS[project],
751
755
                        'branch': branch,
752
756
                    }
753
757
                    repos.append(repo)
754
 
            elif service == 'nova':
 
758
 
 
759
            elif service in ['nova-cloud-controller', 'nova-compute']:
 
760
                core_project = 'nova'
755
761
                repo = {
756
762
                    'name': 'neutron',
757
763
                    'repository': GIT_DEFAULT_REPOS['neutron'],
758
764
                    'branch': branch,
759
765
                }
760
766
                repos.append(repo)
 
767
            elif service == 'openstack-dashboard':
 
768
                core_project = 'horizon'
761
769
 
762
 
            # finally add the current service's repo
 
770
            # finally add the current service's core project repo
763
771
            repo = {
764
 
                'name': service,
765
 
                'repository': GIT_DEFAULT_REPOS[service],
 
772
                'name': core_project,
 
773
                'repository': GIT_DEFAULT_REPOS[core_project],
766
774
                'branch': branch,
767
775
            }
768
776
            repos.append(repo)
769
777
 
770
778
            return yaml.dump(dict(repositories=repos))
771
779
 
772
 
    return projects
 
780
    return projects_yaml
773
781
 
774
782
 
775
783
def _git_yaml_load(projects_yaml):