blob: 477becef27174725812022dd737fea525f175dfc [file] [log] [blame]
apw059e1b12006-10-12 17:18:26 +00001"""The Job Configuration
2
3The job configuration, holding configuration variable supplied to the job.
apw8ad56be2006-11-06 17:49:54 +00004
5The config should be viewed as a hierachical namespace. The elements
6of the hierachy are separated by periods (.) and where multiple words
7are required at a level they should be separated by underscores (_).
8Please no StudlyCaps.
9
10For example:
jadmanski0afbb632008-06-06 21:10:57 +000011 boot.default_args
apw059e1b12006-10-12 17:18:26 +000012"""
13
14__author__ = """Copyright Andy Whitcroft 2006"""
15
apw0c01f072006-11-02 00:21:26 +000016import os
17
apw059e1b12006-10-12 17:18:26 +000018class config:
jadmanski0afbb632008-06-06 21:10:57 +000019 """The BASIC job configuration
apw059e1b12006-10-12 17:18:26 +000020
jadmanski0afbb632008-06-06 21:10:57 +000021 Properties:
22 job
23 The job object for this job
24 config
25 The job configuration dictionary
26 """
apw059e1b12006-10-12 17:18:26 +000027
jadmanski0afbb632008-06-06 21:10:57 +000028 def __init__(self, job):
29 """
30 job
31 The job object for this job
32 """
33 self.job = job
34 self.config = {}
apw059e1b12006-10-12 17:18:26 +000035
36
jadmanski0afbb632008-06-06 21:10:57 +000037 def set(self, name, value):
38 if name == "proxy":
39 os.environ['http_proxy'] = value
40 os.environ['ftp_proxy'] = value
apw0c01f072006-11-02 00:21:26 +000041
jadmanski0afbb632008-06-06 21:10:57 +000042 self.config[name] = value
apw059e1b12006-10-12 17:18:26 +000043
jadmanski0afbb632008-06-06 21:10:57 +000044 def get(self, name):
45 if name in self.config:
46 return self.config[name]
47 else:
48 return None