49
48
'motd_sys_info': ('motd_sys_info', True),
52
# These are values which will never be base64 encoded.
53
# They come from the cloud platform, not user
54
SMARTOS_NO_BASE64 = ['root_authorized_keys', 'motd_sys_info',
52
DS_CFG_PATH = ['datasource', DS_NAME]
53
# BUILT-IN DATASOURCE CONFIGURATION
54
# The following is the built-in configuration. If the values
55
# are not set via the system configuration, then these default
57
# serial_device: which serial device to use for the meta-data
58
# seed_timeout: how long to wait on the device
59
# no_base64_decode: values which are not base64 encoded and
60
# are fetched directly from SmartOS, not meta-data values
61
# base64_keys: meta-data keys that are delivered in base64
62
# base64_all: with the exclusion of no_base64_decode values,
63
# treat all meta-data as base64 encoded
64
# disk_setup: describes how to partition the ephemeral drive
65
# fs_setup: describes how to format the ephemeral drive
68
'serial_device': '/dev/ttyS1',
70
'no_base64_decode': ['root_authorized_keys',
75
'ephemeral_disk': '/dev/vdb',
77
'ephemeral0': {'table_type': 'mbr',
81
'fs_setup': [{'label': 'ephemeral0', 'filesystem': 'ext3',
82
'device': '/dev/xvdb', 'partition': 'auto'}],
58
86
class DataSourceSmartOS(sources.DataSource):
59
87
def __init__(self, sys_cfg, distro, paths):
60
88
sources.DataSource.__init__(self, sys_cfg, distro, paths)
61
self.seed_dir = os.path.join(paths.seed_dir, 'sdc')
62
89
self.is_smartdc = None
64
self.seed = self.ds_cfg.get("serial_device", DEF_TTY_LOC)
65
self.seed_timeout = self.ds_cfg.get("serial_timeout", DEF_TTY_TIMEOUT)
66
self.smartos_no_base64 = self.ds_cfg.get('no_base64_decode',
68
self.b64_keys = self.ds_cfg.get('base64_keys', [])
69
self.b64_all = self.ds_cfg.get('base64_all', False)
91
self.ds_cfg = util.mergemanydict([
93
util.get_cfg_by_path(sys_cfg, DS_CFG_PATH, {}),
98
self.cfg['disk_setup'] = self.ds_cfg.get('disk_setup')
99
self.cfg['fs_setup'] = self.ds_cfg.get('fs_setup')
101
self.seed = self.ds_cfg.get("serial_device")
102
self.seed_timeout = self.ds_cfg.get("serial_timeout")
103
self.smartos_no_base64 = self.ds_cfg.get('no_base64_decode')
104
self.b64_keys = self.ds_cfg.get('base64_keys')
105
self.b64_all = self.ds_cfg.get('base64_all')
71
107
def __str__(self):
72
108
root = sources.DataSource.__str__(self)