Add support for ubuntu-advantage in autoinstall
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
This commit is contained in:
parent
73bc16b8fb
commit
76278f4d74
|
@ -260,6 +260,14 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"ubuntu-advantage": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"token": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"proxy": {
|
"proxy": {
|
||||||
"type": [
|
"type": [
|
||||||
"string",
|
"string",
|
||||||
|
|
|
@ -29,6 +29,29 @@ class UbuntuAdvantageController(SubiquityController):
|
||||||
endpoint = API.ubuntu_advantage
|
endpoint = API.ubuntu_advantage
|
||||||
|
|
||||||
model_name = "ubuntu_advantage"
|
model_name = "ubuntu_advantage"
|
||||||
|
autoinstall_key = "ubuntu-advantage"
|
||||||
|
autoinstall_schema = {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"token": {
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def load_autoinstall_data(self, data: dict) -> None:
|
||||||
|
""" Load autoinstall data and update the model. """
|
||||||
|
if data is None:
|
||||||
|
return
|
||||||
|
self.model.token = data.get("token", "")
|
||||||
|
|
||||||
|
def make_autoinstall(self) -> dict:
|
||||||
|
""" Return a dictionary that can be used as an autoinstall snippet for
|
||||||
|
Ubuntu Advantage.
|
||||||
|
"""
|
||||||
|
return {
|
||||||
|
"token": self.model.token
|
||||||
|
}
|
||||||
|
|
||||||
def serialize(self) -> str:
|
def serialize(self) -> str:
|
||||||
""" Save the current state of the model so it can be loaded later.
|
""" Save the current state of the model so it can be loaded later.
|
||||||
|
|
Loading…
Reference in New Issue