]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
use custom repo from conf if THE UNIVERSE is aligned with us
authorAlfredo Deza <alfredo.deza@inktank.com>
Thu, 13 Mar 2014 19:41:20 +0000 (15:41 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Thu, 13 Mar 2014 19:41:20 +0000 (15:41 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/install.py

index 3d1632984c1958c350dc82e9b7fe2f05476da826..8ff77d5c386cc723bb08f2fa9988b500ec57ef6a 100644 (file)
@@ -76,8 +76,8 @@ def install(args):
             )
 
         # Detect and install custom repos here if needed
-        elif cd_conf and cd_conf.has_repos and not repo_url:
-            LOG.info('detected custom repositories from config file')
+        elif should_use_custom_repo(args, cd_conf, repo_url):
+            LOG.info('detected valid custom repositories from config file')
             custom_repo(distro, args, cd_conf, rlogger)
 
         else:  # otherwise a normal installation
@@ -93,6 +93,23 @@ def install(args):
         distro.conn.exit()
 
 
+def should_use_custom_repo(args, cd_conf, repo_url):
+    """
+    A boolean to determine the logic needed to proceed with a custom repo
+    installation instead of cramming everything nect to the logic operator.
+    """
+    if repo_url:
+        # repo_url signals a CLI override, return False immediately
+        return False
+    if cd_conf:
+        if cd_conf.has_repos:
+            has_valid_release = args.release in cd_conf.get_repos()
+            has_default_repo = cd_conf.get_default_repo()
+            if has_valid_release or has_default_repo:
+                return True
+    return False
+
+
 def custom_repo(distro, args, cd_conf, rlogger):
     """
     A custom repo install helper that will go through config checks to retrieve