diff options
author | Ross Brattain <ross.b.brattain@intel.com> | 2018-03-08 14:45:06 -0800 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2018-03-20 13:00:43 -0700 |
commit | fd63fe609e29b836c35e7ce3110464fa0cf8fca3 (patch) | |
tree | b57a20352921f3d2db459688954c3502c4fec5c8 /api/resources/v1/env.py | |
parent | 5f61719a12ff20df3679d01578de84110f68302f (diff) |
env: validate installer_ip from environment
validate installer_ip is proper IPv4 address in case of user error
Change-Id: Ib01916bc85ec411c159af1564f5142177f464047
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'api/resources/v1/env.py')
-rw-r--r-- | api/resources/v1/env.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/api/resources/v1/env.py b/api/resources/v1/env.py index 75c981a96..6c9eb8324 100644 --- a/api/resources/v1/env.py +++ b/api/resources/v1/env.py @@ -10,12 +10,16 @@ from __future__ import absolute_import import errno import logging + +import ipaddress import os import subprocess import threading import time import uuid import glob + +import six import yaml import collections @@ -269,6 +273,8 @@ class V1Env(ApiResource): LOG.info('Openrc file not found') installer_ip = os.environ.get('INSTALLER_IP', '192.168.200.2') + # validate installer_ip is a valid ipaddress + installer_ip = str(ipaddress.IPv4Address(six.u(installer_ip))) installer_type = os.environ.get('INSTALLER_TYPE', 'compass') LOG.info('Getting openrc file from %s', installer_type) self._get_remote_rc_file(rc_file, |