-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting the environment in the container
- Loading branch information
Thirumal Ravula
committed
Sep 29, 2014
1 parent
c76907b
commit 7391fa7
Showing
7 changed files
with
158 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
ovpl | ||
==== | ||
|
||
1) Edit the file ovpl/config/config.json to set the proxies | ||
|
||
"ENVIRONMENT": { | ||
"HTTP_PROXY":"proxy.vlabs.ac.in:8080", | ||
"HTTPS_PROXY":"proxy.vlabs.ac.in:8080" | ||
}, | ||
|
||
2) Do the same with the file ovpl/src/VMManager/config.json | ||
|
||
3) Edit the file ovpl/src/settings.py to set the | ||
SUBNET field to match with the subnet of your base machine | ||
|
||
If the ip address of your base machine is 10.2.58.XXX, | ||
|
||
SUBNET = ["10.2.58.12/28"] | ||
|
||
4) Do the same with the file ovpl/src/adapters/settings.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
|
||
"ENVIRONMENT": { | ||
"HTTP_PROXY":"proxy.vlabs.ac.in:8080", | ||
"HTTPS_PROXY":"proxy.vlabs.ac.in:8080" | ||
}, | ||
|
||
"CONTROLLER_CONFIG": { | ||
"SERVER_PORT":8080, | ||
"LOG_FILENAME":"/root/ovpl/log/ovpl.log" | ||
}, | ||
|
||
"LABMANAGER_CONFIG": { | ||
"GIT_CLONE_LOC":"/root/labs/lab-repo-cache/", | ||
"LAB_SPEC_LOC":"/scripts/labspec.json" | ||
}, | ||
|
||
"VMMANAGER_CONFIG": { | ||
"DISK_USAGE_URI":"/api/1.0/disk-usage", | ||
"MEMORY_USAGE_URI":"/api/1.0/mem-usage", | ||
"RUNNING_TIME_URI":"/api/1.0/running-time", | ||
"RUNNING_PROCESSES_URI":"/api/1.0/running-processes", | ||
"CPU_LOAD_URI":"/api/1.0/cpu_load", | ||
"EXECUTE_URI":"/api/1.0/execute/([\\w*\\d*\\%\\-]+)", | ||
"TEST_LAB_URI":"/api/1.0/test-lab", | ||
"SERVER_PORT":8089, | ||
"GIT_CLONE_LOC":"/root/VMManager/lab-repo-cache/", | ||
"LAB_SPEC_LOC":"/scripts/labspec.json", | ||
"LOG_FILENAME":"/root/VMManager/log/vmmanager.log" | ||
}, | ||
|
||
"API_ENDPOINTS": { | ||
"__comment__":"used by vm pool manager", | ||
"CREATE_URI_ADAPTER_ENDPOINT":"/api/1.0/vm/create", | ||
"DESTROY_URI_ADAPTER_ENDPOINT":"/api/1.0/vm/destroy", | ||
"RESTART_URI_ADAPTER_ENDPOINT":"/api/1.0/vm/restart" | ||
}, | ||
|
||
"VMPOOL_CONFIGURATION": { | ||
"VMPOOLS": [ | ||
{ | ||
"POOLID":1, | ||
"DESCRIPTION":"LINUX", | ||
"ADAPTERIP":"http://localhost", | ||
"PORT":"8000" | ||
}, | ||
{ | ||
"POOLID":2, | ||
"DESCRIPTION":"WINDOWS", | ||
"ADAPTERIP":"http://localhost", | ||
"PORT":"8000" | ||
}, | ||
{ | ||
"POOLID":3, | ||
"DESCRIPTION":"AMAZONS3", | ||
"ADAPTERIP":"http://localhost", | ||
"PORT":"8000" | ||
}, | ||
{ | ||
"POOLID":4, | ||
"DESCRIPTION":"AMAZONEC2", | ||
"ADAPTERIP":"http://localhost", | ||
"PORT":"8000" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import os | ||
import sys | ||
import json | ||
|
||
|
||
class EnvSetUp: | ||
|
||
|
||
def __init__(self): | ||
#do nothing | ||
self.ovpl_directory_path = None | ||
self.config_spec = None | ||
self.http_proxy = None | ||
self.https_proxy = None | ||
self.no_proxy = "" | ||
self.set_ovpl_directory_path() | ||
self.setup_pythonpath() | ||
self.create_no_proxy_string() | ||
self.get_proxy_values() | ||
self.set_environment() | ||
|
||
|
||
def set_ovpl_directory_path(self): | ||
# The assumption here is that this script is in the src directory | ||
# which is one directory above ovpl | ||
self.ovpl_directory_path = os.path.dirname(os.path.abspath(__file__)) | ||
print self.ovpl_directory_path | ||
|
||
def setup_pythonpath(self): | ||
sys.path.append(self.ovpl_directory_path) | ||
|
||
|
||
def create_no_proxy_string(self): | ||
|
||
self.no_proxy += "localhost" | ||
|
||
|
||
def get_proxy_values(self): | ||
|
||
self.config_spec = json.loads(open(self.ovpl_directory_path + "/config.json").read()) | ||
self.http_proxy = self.config_spec["ENVIRONMENT"]["HTTP_PROXY"] | ||
self.https_proxy = self.config_spec["ENVIRONMENT"]["HTTPS_PROXY"] | ||
|
||
def set_environment(self): | ||
os.environ["http_proxy"] = self.http_proxy | ||
os.environ["https_proxy"] = self.https_proxy | ||
os.environ["no_proxy"] = self.no_proxy | ||
if "PYTHONPATH" in os.environ: | ||
os.environ["PYTHONPATH"] += ":" | ||
os.environ["PYTHONPATH"] += self.ovpl_directory_path | ||
else: | ||
os.environ["PYTHONPATH"] = self.ovpl_directory_path | ||
|
||
|
||
if __name__ == '__main__': | ||
e = EnvSetUp() | ||
# print e.ovpl_directory_path | ||
# print e.no_proxy | ||
# print e.http_proxy | ||
# print e.https_proxy | ||
print os.environ["http_proxy"] | ||
print os.environ["https_proxy"] | ||
print os.environ["no_proxy"] | ||
print os.environ["PYTHONPATH"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters