~gandelman-a/charms/precise/swift-storage/upgrade

« back to all changes in this revision

Viewing changes to hooks/lib/openstack-common

  • Committer: Adam Gandelman
  • Date: 2013-01-11 02:19:18 UTC
  • mfrom: (16.1.1 swift-storage)
  • Revision ID: adamg@canonical.com-20130111021918-arvlnccc3cneptow
Sync openstack-common.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
 
84
84
  # Cloud Archive
85
85
  if [[ "${src:0:6}" == "cloud:" ]] ; then
86
 
    local archive_key="5EDB1B62EC4926EA"
87
 
    local rel=$(echo $src | cut -d: -f2)
88
 
    local u_rel=$(echo $rel | cut -d- -f1)
89
 
    local ca_rel=$(echo $rel | cut -d- -f2)
 
86
 
 
87
    # current os releases supported by the UCA.
 
88
    local cloud_archive_versions="folsom grizzly"
 
89
 
 
90
    local ca_rel=$(echo $src | cut -d: -f2)
 
91
    local u_rel=$(echo $ca_rel | cut -d- -f1)
 
92
    local os_rel=$(echo $ca_rel | cut -d- -f2 | cut -d/ -f1)
90
93
 
91
94
    [[ "$u_rel" != "$DISTRIB_CODENAME" ]] &&
92
95
      error_out "Cannot install from Cloud Archive pocket $src " \
93
96
                "on this Ubuntu version ($DISTRIB_CODENAME)!"
94
97
 
 
98
    valid_release=""
 
99
    for rel in $cloud_archive_versions ; do
 
100
      if [[ "$os_rel" == "$rel" ]] ; then
 
101
        valid_release=1
 
102
        juju-log "Installing OpenStack ($os_rel) from the Ubuntu Cloud Archive."
 
103
      fi
 
104
    done
 
105
    if [[ -z "$valid_release" ]] ; then
 
106
      error_out "OpenStack release ($os_rel) not supported by "\
 
107
                "the Ubuntu Cloud Archive."
 
108
    fi
 
109
 
95
110
    # CA staging repos are standard PPAs.
96
111
    if echo $ca_rel | grep -q "staging" ; then
97
112
      ca_rel=$(echo $ca_rel | sed -e 's,/,-,g')
101
116
 
102
117
    # the others are LP-external deb repos.
103
118
    case "$ca_rel" in
104
 
      "folsom"|"folsom/updates") pocket="precise-updates/folsom" ;;
105
 
      "folsom/proposed") pocket="precise-proposed/folsom" ;;
 
119
      "$u_rel-$os_rel"|"$u_rel-$os_rel/updates") pocket="$u_rel-updates/$os_rel" ;;
 
120
      "$u_rel-$os_rel/proposed") pocket="$u_rel-proposed/$os_rel" ;;
 
121
      "$u_rel-$os_rel"|"$os_rel/updates") pocket="$u_rel-updates/$os_rel" ;;
 
122
      "$u_rel-$os_rel/proposed") pocket="$u_rel-proposed/$os_rel" ;;
106
123
      *) error_out "Invalid Cloud Archive repo specified: $src"
107
124
    esac
108
125
 
 
126
    apt-get -y install ubuntu-cloud-keyring
109
127
    entry="deb http://ubuntu-cloud.archive.canonical.com/ubuntu $pocket main"
110
128
    echo "$entry" \
111
129
      >/etc/apt/sources.list.d/ubuntu-cloud-archive-$DISTRIB_CODENAME.list
112
 
    apt-key  adv --keyserver keyserver.ubuntu.com --recv-keys $archive_key
113
130
    return 0
114
131
  fi
115
132