3
# Copyright (C) 2015 Canonical Ltd.
4
# Copyright (C) 2015 VMware Inc.
6
# Author: Sankar Tanguturi <stanguturi@vmware.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License version 3, as
10
# published by the Free Software Foundation.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
25
Stores the Contents specified in the Customization
29
DNS = 'DNS|NAMESERVER|'
30
SUFFIX = 'DNS|SUFFIX|'
31
PASS = 'PASSWORD|-PASS'
32
TIMEZONE = 'DATETIME|TIMEZONE'
34
HOSTNAME = 'NETWORK|HOSTNAME'
35
DOMAINNAME = 'NETWORK|DOMAINNAME'
37
def __init__(self, configFile):
38
self._configFile = configFile
42
"""Return the hostname."""
43
return self._configFile.get(Config.HOSTNAME, None)
46
def domain_name(self):
47
"""Return the domain name."""
48
return self._configFile.get(Config.DOMAINNAME, None)
52
"""Return the timezone."""
53
return self._configFile.get(Config.TIMEZONE, None)
57
"""Retrieves whether to set time to UTC or Local."""
58
return self._configFile.get(Config.UTC, None)
61
def admin_password(self):
62
"""Return the root password to be set."""
63
return self._configFile.get(Config.PASS, None)
66
def name_servers(self):
67
"""Return the list of DNS servers."""
69
cnt = self._configFile.get_count_with_prefix(Config.DNS)
70
for i in range(1, cnt + 1):
71
key = Config.DNS + str(i)
72
res.append(self._configFile[key])
77
def dns_suffixes(self):
78
"""Return the list of DNS Suffixes."""
80
cnt = self._configFile.get_count_with_prefix(Config.SUFFIX)
81
for i in range(1, cnt + 1):
82
key = Config.SUFFIX + str(i)
83
res.append(self._configFile[key])
89
"""Return the list of associated NICs."""
91
nics = self._configFile['NIC-CONFIG|NICS']
92
for nic in nics.split(','):
93
res.append(Nic(nic, self._configFile))