support user-data section of autoinstall file
This commit is contained in:
parent
291e1950ba
commit
17a6d960c6
|
@ -29,6 +29,7 @@ from ..controller import RepeatedController
|
|||
from .reporting import ReportingController
|
||||
from .snaplist import SnapListController
|
||||
from .ssh import SSHController
|
||||
from .userdata import UserdataController
|
||||
from .welcome import WelcomeController
|
||||
from .zdev import ZdevController
|
||||
__all__ = [
|
||||
|
@ -49,6 +50,7 @@ __all__ = [
|
|||
'ReportingController',
|
||||
'SnapListController',
|
||||
'SSHController',
|
||||
'UserdataController',
|
||||
'WelcomeController',
|
||||
'ZdevController',
|
||||
]
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# Copyright 2020 Canonical, Ltd.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from subiquity.controller import NoUIController
|
||||
|
||||
|
||||
class UserdataController(NoUIController):
|
||||
|
||||
model_name = 'userdata'
|
||||
autoinstall_key = "user-data"
|
||||
autoinstall_default = {}
|
||||
autoinstall_schema = {
|
||||
'type': 'object',
|
||||
}
|
||||
|
||||
def load_autoinstall_data(self, data):
|
||||
self.model.clear()
|
||||
self.model.update(data)
|
||||
|
||||
def make_autoinstall(self):
|
||||
return self.app.base_model.userdata
|
|
@ -99,6 +99,7 @@ class Subiquity(Application):
|
|||
"Early",
|
||||
"Reporting",
|
||||
"Error",
|
||||
"Userdata",
|
||||
"Package",
|
||||
"Debconf",
|
||||
"Welcome",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import copy
|
||||
from collections import OrderedDict
|
||||
import logging
|
||||
import os
|
||||
|
@ -79,6 +80,7 @@ POSTINSTALL_MODEL_NAMES = [
|
|||
"packages",
|
||||
"snaplist",
|
||||
"ssh",
|
||||
"userdata",
|
||||
]
|
||||
|
||||
ALL_MODEL_NAMES = INSTALL_MODEL_NAMES + POSTINSTALL_MODEL_NAMES
|
||||
|
@ -114,6 +116,7 @@ class SubiquityModel:
|
|||
self.proxy = ProxyModel()
|
||||
self.snaplist = SnapListModel()
|
||||
self.ssh = SSHModel()
|
||||
self.userdata = {}
|
||||
|
||||
self._events = {
|
||||
name: asyncio.Event() for name in ALL_MODEL_NAMES
|
||||
|
@ -184,7 +187,9 @@ class SubiquityModel:
|
|||
config['snap'] = {
|
||||
'commands': cmds,
|
||||
}
|
||||
return config
|
||||
userdata = copy.deepcopy(self.userdata)
|
||||
merge_config(userdata, config)
|
||||
return userdata
|
||||
|
||||
def _cloud_init_files(self):
|
||||
# TODO, this should be moved to the in-target cloud-config seed so on
|
||||
|
|
Loading…
Reference in New Issue