summaryrefslogtreecommitdiffstats
path: root/apex/common
diff options
context:
space:
mode:
Diffstat (limited to 'apex/common')
-rw-r--r--apex/common/constants.py16
-rw-r--r--apex/common/utils.py42
2 files changed, 34 insertions, 24 deletions
diff --git a/apex/common/constants.py b/apex/common/constants.py
index 4f72b082..89c3e6e1 100644
--- a/apex/common/constants.py
+++ b/apex/common/constants.py
@@ -39,10 +39,13 @@ VIRT_PW = '--root-password'
THT_DIR = '/usr/share/openstack-tripleo-heat-templates'
THT_ENV_DIR = os.path.join(THT_DIR, 'environments')
-THT_DOCKER_ENV_DIR = os.path.join(THT_ENV_DIR, 'services-docker')
+THT_DOCKER_ENV_DIR = {
+ 'master': os.path.join(THT_ENV_DIR, 'services'),
+ 'queens': os.path.join(THT_ENV_DIR, 'services-docker')
+}
-DEFAULT_OS_VERSION = 'pike'
-DEFAULT_ODL_VERSION = 'nitrogen'
+DEFAULT_OS_VERSION = 'master'
+DEFAULT_ODL_VERSION = 'oxygen'
VALID_ODL_VERSIONS = ['carbon', 'nitrogen', 'oxygen', 'master']
CEPH_VERSION_MAP = {'pike': 'jewel',
'queens': 'luminous',
@@ -52,7 +55,8 @@ PUPPET_ODL_URL = 'https://git.opendaylight.org/gerrit/integration/packaging' \
DEBUG_OVERCLOUD_PW = 'opnfvapex'
NET_ENV_FILE = 'network-environment.yaml'
DEPLOY_TIMEOUT = 90
-UPSTREAM_RDO = 'https://images.rdoproject.org/pike/delorean/current-tripleo/'
+UPSTREAM_RDO = 'https://images.rdoproject.org/master/delorean/current' \
+ '-tripleo-rdo/'
OPENSTACK_GERRIT = 'https://review.openstack.org'
DOCKER_TAG = 'current-tripleo-rdo'
@@ -64,5 +68,5 @@ VALID_DOCKER_SERVICES = {
'neutron-opendaylight-sriov.yaml': None,
'neutron-ml2-ovn.yaml': 'neutron-ovn.yaml'
}
-DOCKERHUB_OOO = ('https://registry.hub.docker.com/v2/repositories'
- '/tripleoupstream/?page_size=1024')
+DOCKERHUB_OOO = 'https://registry.hub.docker.com/v2/repositories' \
+ '/tripleomaster/'
diff --git a/apex/common/utils.py b/apex/common/utils.py
index cb7cbe13..2ac900a3 100644
--- a/apex/common/utils.py
+++ b/apex/common/utils.py
@@ -141,6 +141,28 @@ def run_ansible(ansible_vars, playbook, host='localhost', user='root',
raise Exception(e)
+def get_url_modified_date(url):
+ """
+ Returns the last modified date for an Tripleo image artifact
+ :param url: URL to examine
+ :return: datetime object of when artifact was last modified
+ """
+ try:
+ u = urllib.request.urlopen(url)
+ except urllib.error.URLError as e:
+ logging.error("Failed to fetch target url. Error: {}".format(
+ e.reason))
+ raise
+
+ metadata = u.info()
+ headers = metadata.items()
+ for header in headers:
+ if isinstance(header, tuple) and len(header) == 2:
+ if header[0] == 'Last-Modified':
+ return datetime.datetime.strptime(header[1],
+ "%a, %d %b %Y %X GMT")
+
+
def fetch_upstream_and_unpack(dest, url, targets, fetch=True):
"""
Fetches targets from a url destination and downloads them if they are
@@ -171,30 +193,14 @@ def fetch_upstream_and_unpack(dest, url, targets, fetch=True):
if download_target:
logging.debug("Fetching and comparing upstream"
" target: \n{}".format(target_url))
- try:
- u = urllib.request.urlopen(target_url)
- except urllib.error.URLError as e:
- logging.error("Failed to fetch target url. Error: {}".format(
- e.reason))
- raise
# Check if previous file and fetch we need to compare files to
# determine if download is necessary
if target_exists and download_target:
logging.debug("Previous file found: {}".format(target_dest))
- metadata = u.info()
- headers = metadata.items()
- target_url_date = None
- for header in headers:
- if isinstance(header, tuple) and len(header) == 2:
- if header[0] == 'Last-Modified':
- target_url_date = header[1]
- break
+ target_url_date = get_url_modified_date(target_url)
if target_url_date is not None:
target_dest_mtime = os.path.getmtime(target_dest)
- target_url_mtime = time.mktime(
- datetime.datetime.strptime(target_url_date,
- "%a, %d %b %Y %X "
- "GMT").timetuple())
+ target_url_mtime = time.mktime(target_url_date.timetuple())
if target_url_mtime > target_dest_mtime:
logging.debug('URL target is newer than disk...will '
'download')