-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…R-6293 AutoinstallError exception
- Loading branch information
Showing
30 changed files
with
686 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
import logging | ||
|
||
log = logging.getLogger("subiquity.server.autoinstall") | ||
|
||
|
||
class AutoinstallError(Exception): | ||
pass | ||
|
||
|
||
class AutoinstallValidationError(AutoinstallError): | ||
def __init__( | ||
self, | ||
owner: str, | ||
): | ||
self.message = f"Malformed autoinstall in {owner!r} section" | ||
self.owner = owner | ||
super().__init__(self.message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
|
||
import jsonschema | ||
from jsonschema.validators import validator_for | ||
|
||
from subiquity.server.controllers.cmdlist import CmdListController | ||
from subiquitycore.tests import SubiTestCase | ||
|
||
|
||
class TestCmdListController(SubiTestCase): | ||
def test_valid_schema(self): | ||
"""Test that the expected autoinstall JSON schema is valid""" | ||
|
||
JsonValidator: jsonschema.protocols.Validator = validator_for( | ||
CmdListController.autoinstall_schema | ||
) | ||
|
||
JsonValidator.check_schema(CmdListController.autoinstall_schema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
|
||
import jsonschema | ||
from jsonschema.validators import validator_for | ||
|
||
from subiquity.server.controllers.codecs import CodecsController | ||
from subiquitycore.tests import SubiTestCase | ||
|
||
|
||
class TestCodecsController(SubiTestCase): | ||
def test_valid_schema(self): | ||
"""Test that the expected autoinstall JSON schema is valid""" | ||
|
||
JsonValidator: jsonschema.protocols.Validator = validator_for( | ||
CodecsController.autoinstall_schema | ||
) | ||
|
||
JsonValidator.check_schema(CodecsController.autoinstall_schema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
|
||
import jsonschema | ||
from jsonschema.validators import validator_for | ||
|
||
from subiquity.server.controllers.debconf import DebconfController | ||
from subiquitycore.tests import SubiTestCase | ||
|
||
|
||
class TestDebconfController(SubiTestCase): | ||
def test_valid_schema(self): | ||
"""Test that the expected autoinstall JSON schema is valid""" | ||
|
||
JsonValidator: jsonschema.protocols.Validator = validator_for( | ||
DebconfController.autoinstall_schema | ||
) | ||
|
||
JsonValidator.check_schema(DebconfController.autoinstall_schema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
|
||
import jsonschema | ||
from jsonschema.validators import validator_for | ||
|
||
from subiquity.server.controllers.drivers import DriversController | ||
from subiquitycore.tests import SubiTestCase | ||
|
||
|
||
class TestDriversController(SubiTestCase): | ||
def test_valid_schema(self): | ||
"""Test that the expected autoinstall JSON schema is valid""" | ||
|
||
JsonValidator: jsonschema.protocols.Validator = validator_for( | ||
DriversController.autoinstall_schema | ||
) | ||
|
||
JsonValidator.check_schema(DriversController.autoinstall_schema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
|
||
import jsonschema | ||
from jsonschema.validators import validator_for | ||
|
||
from subiquity.server.controllers.identity import IdentityController | ||
from subiquitycore.tests import SubiTestCase | ||
|
||
|
||
class TestIdentityController(SubiTestCase): | ||
def test_valid_schema(self): | ||
"""Test that the expected autoinstall JSON schema is valid""" | ||
|
||
JsonValidator: jsonschema.protocols.Validator = validator_for( | ||
IdentityController.autoinstall_schema | ||
) | ||
|
||
JsonValidator.check_schema(IdentityController.autoinstall_schema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
|
||
import jsonschema | ||
from jsonschema.validators import validator_for | ||
|
||
from subiquity.server.controllers.locale import LocaleController | ||
from subiquitycore.tests import SubiTestCase | ||
|
||
|
||
class TestLocaleController(SubiTestCase): | ||
def test_valid_schema(self): | ||
"""Test that the expected autoinstall JSON schema is valid""" | ||
|
||
JsonValidator: jsonschema.protocols.Validator = validator_for( | ||
LocaleController.autoinstall_schema | ||
) | ||
|
||
JsonValidator.check_schema(LocaleController.autoinstall_schema) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2024 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/>. | ||
|
||
import jsonschema | ||
from jsonschema.validators import validator_for | ||
|
||
from subiquity.server.controllers.network import NetworkController | ||
from subiquitycore.tests import SubiTestCase | ||
|
||
|
||
class TestNetworkController(SubiTestCase): | ||
def test_valid_schema(self): | ||
"""Test that the expected autoinstall JSON schema is valid""" | ||
|
||
JsonValidator: jsonschema.protocols.Validator = validator_for( | ||
NetworkController.autoinstall_schema | ||
) | ||
|
||
JsonValidator.check_schema(NetworkController.autoinstall_schema) |
Oops, something went wrong.