Browse code

Backport Grenade updates

Backport changes made in Grenade's copy of functions since the last sync:
* d0654b9,i 4c7726e - get_release_name_from_branch()
* 7907766 - edits to install_package()

Change-Id: I0714c0b1072f1360c3c08fe24225e65e2a550fad

Dean Troyer authored on 2014/02/13 03:09:22
Showing 1 changed files
... ...
@@ -460,6 +460,17 @@ function is_ubuntu {
460 460
 # Git Functions
461 461
 # =============
462 462
 
463
+# Returns openstack release name for a given branch name
464
+# ``get_release_name_from_branch branch-name``
465
+function get_release_name_from_branch(){
466
+    local branch=$1
467
+    if [[ $branch =~ "stable/" ]]; then
468
+        echo ${branch#*/}
469
+    else
470
+        echo "master"
471
+    fi
472
+}
473
+
463 474
 # git clone only if directory doesn't exist already.  Since ``DEST`` might not
464 475
 # be owned by the installation user, we create the directory and change the
465 476
 # ownership to the proper user.
... ...
@@ -792,7 +803,9 @@ function get_packages() {
792 792
 # install_package package [package ...]
793 793
 function install_package() {
794 794
     if is_ubuntu; then
795
-        [[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update
795
+        # if there are transient errors pulling the updates, that's fine. It may
796
+        # be secondary repositories that we don't really care about.
797
+        [[ "$NO_UPDATE_REPOS" = "True" ]] || apt_get update || /bin/true
796 798
         NO_UPDATE_REPOS=True
797 799
 
798 800
         apt_get install "$@"