~openstack-charmers/charms/trusty/heat/next

« back to all changes in this revision

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

  • Committer: David Ames
  • Date: 2016-07-15 17:44:59 UTC
  • Revision ID: david.ames@canonical.com-20160715174459-3u28uzq23r40guji
Pre-release charm-helpers sync

To begin release testing get each charm up to date with lp:charm-helpers

Change-Id: I2d117aad4851fe355e8c808710d0d9a1e51b76ff

Show diffs side-by-side

added added

removed removed

Lines of Context:
220
220
}
221
221
 
222
222
GIT_DEFAULT_BRANCHES = {
223
 
    'kilo': 'stable/kilo',
224
223
    'liberty': 'stable/liberty',
225
224
    'mitaka': 'stable/mitaka',
226
225
    'master': 'master',
413
412
    global os_rel
414
413
    if os_rel:
415
414
        return os_rel
416
 
    os_rel = (get_os_codename_package(package, fatal=False) or
 
415
    os_rel = (git_os_codename_install_source(config('openstack-origin-git')) or
 
416
              get_os_codename_package(package, fatal=False) or
417
417
              get_os_codename_install_source(config('openstack-origin')) or
418
418
              base)
419
419
    return os_rel
719
719
    return config('openstack-origin-git') is not None
720
720
 
721
721
 
722
 
requirements_dir = None
 
722
def git_os_codename_install_source(projects_yaml):
 
723
    """
 
724
    Returns OpenStack codename of release being installed from source.
 
725
    """
 
726
    if git_install_requested():
 
727
        projects = _git_yaml_load(projects_yaml)
 
728
 
 
729
        if projects in GIT_DEFAULT_BRANCHES.keys():
 
730
            if projects == 'master':
 
731
                return 'newton'
 
732
            return projects
 
733
 
 
734
        if 'release' in projects:
 
735
            if projects['release'] == 'master':
 
736
                return 'newton'
 
737
            return projects['release']
 
738
 
 
739
    return None
723
740
 
724
741
 
725
742
def git_default_repos(projects_yaml):
740
757
            }
741
758
            repos = [repo]
742
759
 
743
 
            # NOTE(coreycb): This is a temp work-around until the requirements
744
 
            # repo moves from stable/kilo branch to kilo-eol tag. The core
745
 
            # repos have already done this.
746
 
            if default == 'kilo':
747
 
                branch = 'kilo-eol'
748
 
 
749
760
            # neutron-* and nova-* charms require some additional repos
750
761
            if service in ['neutron-api', 'neutron-gateway',
751
762
                           'neutron-openvswitch']:
778
789
            }
779
790
            repos.append(repo)
780
791
 
781
 
            return yaml.dump(dict(repositories=repos))
 
792
            return yaml.dump(dict(repositories=repos, release=default))
782
793
 
783
794
    return projects_yaml
784
795
 
793
804
    return yaml.load(projects_yaml)
794
805
 
795
806
 
 
807
requirements_dir = None
 
808
 
 
809
 
796
810
def git_clone_and_install(projects_yaml, core_project):
797
811
    """
798
812
    Clone/install all specified OpenStack repositories.
856
870
            # upper-constraints didn't exist until after icehouse
857
871
            if not os.path.isfile(constraints):
858
872
                constraints = None
 
873
            # use constraints unless project yaml sets use_constraints to false
 
874
            if 'use_constraints' in projects.keys():
 
875
                if not projects['use_constraints']:
 
876
                    constraints = None
859
877
        else:
860
878
            repo_dir = _git_clone_and_install_single(repo, branch, depth,
861
879
                                                     parent_dir, http_proxy,
882
900
    if projects['repositories'][-1]['name'] != core_project:
883
901
        error_out('{} git repo must be specified last'.format(core_project))
884
902
 
 
903
    _git_ensure_key_exists('release', projects)
 
904
 
885
905
 
886
906
def _git_ensure_key_exists(key, keys):
887
907
    """