summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>2018-03-27 12:48:37 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-03-27 12:48:37 +0000
commitebd835c33cc8d0f9124fd2568231c4c069b00661 (patch)
treec217fb4c08c86c4f77b465f9542db56e603229a3
parent9f98dcb078f412157284399e210f26b0eec80ae7 (diff)
parentfd63fe609e29b836c35e7ce3110464fa0cf8fca3 (diff)
Merge "env: validate installer_ip from environment"
-rw-r--r--api/resources/v1/env.py6
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,