fix for omitting identity section when passing user-data
This commit is contained in:
parent
51e235d4a2
commit
e91f8bbf89
|
@ -0,0 +1,19 @@
|
|||
version: 1
|
||||
early-commands:
|
||||
- echo a
|
||||
- sleep 1
|
||||
- echo a
|
||||
debconf-selections: eek
|
||||
packages:
|
||||
- package1
|
||||
- package2
|
||||
late-commands:
|
||||
- echo a
|
||||
- sleep 1
|
||||
- echo a
|
||||
keyboard:
|
||||
layout: gb
|
||||
user-data:
|
||||
users:
|
||||
- username: ubuntu
|
||||
password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1'
|
|
@ -32,3 +32,8 @@ grep 'finish: subiquity/InstallProgress/postinstall/install_package1: SUCCESS: i
|
|||
.subiquity/subiquity-debug.log
|
||||
grep 'finish: subiquity/InstallProgress/postinstall/install_package2: SUCCESS: installing package2' \
|
||||
.subiquity/subiquity-debug.log
|
||||
|
||||
timeout --foreground 60 sh -c "LANG=C.UTF-8 python3 -m subiquity.cmd.tui --autoinstall examples/autoinstall-user-data.yaml \
|
||||
--dry-run --machine-config examples/simple.json \
|
||||
--kernel-cmdline 'autoinstall console=\"${TTY#/dev/}\"'"
|
||||
python3 scripts/validate-yaml.py .subiquity/subiquity-curtin-install.conf
|
||||
|
|
|
@ -73,6 +73,8 @@ class IdentityController(SubiquityController):
|
|||
self.app.next_screen()
|
||||
|
||||
def make_autoinstall(self):
|
||||
if self.model.user is None:
|
||||
return {}
|
||||
r = attr.asdict(self.model.user)
|
||||
r['hostname'] = self.model.hostname
|
||||
return r
|
||||
|
|
|
@ -202,14 +202,18 @@ class SubiquityModel:
|
|||
# (mwhudson does not entirely know what the above means!)
|
||||
userdata = '#cloud-config\n' + yaml.dump(self._cloud_init_config())
|
||||
metadata = yaml.dump({'instance-id': str(uuid.uuid4())})
|
||||
hostname = self.identity.hostname.strip()
|
||||
return [
|
||||
files = [
|
||||
('var/lib/cloud/seed/nocloud-net/meta-data', metadata, 0o644),
|
||||
('var/lib/cloud/seed/nocloud-net/user-data', userdata, 0o600),
|
||||
('etc/cloud/ds-identify.cfg', 'policy: enabled\n', 0o644),
|
||||
('etc/hostname', hostname + "\n", 0o644),
|
||||
('etc/hosts', HOSTS_CONTENT.format(hostname=hostname), 0o644),
|
||||
]
|
||||
if self.identity.hostname is not None:
|
||||
hostname = self.identity.hostname.strip()
|
||||
files.extend([
|
||||
('etc/hostname', hostname + "\n", 0o644),
|
||||
('etc/hosts', HOSTS_CONTENT.format(hostname=hostname), 0o644),
|
||||
])
|
||||
return files
|
||||
|
||||
def configure_cloud_init(self):
|
||||
for path, content, mode in self._cloud_init_files():
|
||||
|
|
Loading…
Reference in New Issue