Commit Graph

5802 Commits

Author SHA1 Message Date
Olivier Gayot 03a19a764e mirror: pass an alternative config file to apt through the environment
Sadly, passing an alternative config file to apt using -o CLI options
does not work because apt:

1) Reads the configuration file first
2) Reads CLI options (and override specified settings) second

Therefore, the default configuration file is always read, instead of the
one we supply.

To specify an alternative configuration file, the recommendation from
the apt maintainer is to supply an APT_CONFIG variable, hinting apt to
read said file instead of the default.

We now generate a temporary file, write the directives we need to it
using the python apt library, and then execute apt-get with a path to
this temporary file set in APT_CONFIG.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-03-02 19:37:58 +01:00
Olivier Gayot 13309781fa install: when installing package, download first and then install
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-03-02 16:05:26 +01:00
Olivier Gayot 2bf79ddee9 curtin: bump version so we can install a package in two steps
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-03-02 16:05:25 +01:00
Carlos Nihelton 2cede5aadd
No need for partial serialize/deserialize 2023-03-02 10:03:11 -03:00
Carlos Nihelton e40c147f5e
Adds active_directory to the autoinstall reference 2023-03-02 10:03:02 -03:00
Carlos Nihelton 68b6805677
Simpler AD integration test 2023-03-02 09:50:03 -03:00
Carlos Nihelton 7062e6ad3b
Consistent naming - part 2 - longer model name
sticking with "active_directory" for clarity.
2023-03-02 09:49:24 -03:00
Carlos Nihelton 2057dcd64a
Consistent naming - part 1 - AdModel
No other class starts with both capitals 'AD'.
2023-03-02 09:39:53 -03:00
Olivier Gayot 0bf1d65ccb
Merge pull request #1582 from ogayot/curthooks-fix
snapcraft: bump curtin rev to fix curthooks always running apt-config
2023-03-02 10:26:38 +01:00
Olivier Gayot a96ffafc7f snapcraft: bump curtin rev to fix curthooks always running apt-config
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-03-02 09:25:13 +01:00
Ryan Mounce a968b48523 Support LUKS with 'lvm' autoinstall storage layout
Resolves: https://bugs.launchpad.net/subiquity/+bug/1913986
2023-03-02 09:39:55 +10:30
Carlos Nihelton 03af76d431
AD integration testing
Currently only checks if the AD model causes packages to be installed
if the autoinstall contains AD data.
2023-03-01 15:23:30 -03:00
Carlos Nihelton b74ccb8d5d
Implements autoinstall for AD 2023-03-01 14:57:32 -03:00
Carlos Nihelton 65aabe527f
Merge pull request #1572 from CarlosNihelton/ad-result-deeng-577
Active Directory - Implement the actual join
2023-03-01 13:11:25 -03:00
Dan Bungert 359a5caa7d
Merge pull request #1578 from dbungert/lp-2008271-validate-kbd-layout
keyboard: validate layout and variant
2023-03-01 07:04:57 -07:00
Carlos Nihelton 33597e3c7d
Exception safe context manager
Without the try/finally the cleanup could be skipped by an exception
being raised.
2023-03-01 10:37:00 -03:00
Carlos Nihelton babf0255b9
Add the AD model into the POSTINSTALL_MODEL_NAMES
AD is by nature an optional feature.
Yet, we need to make its model part of the POSTINSTALL_MODEL_NAMES set.
That would turn this into a required controller.
Thus, explicitly mark AD as configured
For as long as TUI doesn't have a matching controller.
2023-03-01 10:36:20 -03:00
Olivier Gayot 11f66b9129
Merge pull request #1565 from ogayot/debconf-selections-in-apt-config
debconf-selections: pass to curtin's apt-config rather than curthooks
2023-03-01 13:01:45 +01:00
Olivier Gayot 4d4fe7ae8d
Merge pull request #1577 from ogayot/crash-adding-disk-to-vg
filesystem: don't offer tiny partitions / disks as potential PVs
2023-03-01 12:25:23 +01:00
Dan Bungert 13cae2488e keyboard: validate layout and variant
In LP: #2008271, an invalid but reasonable-looking layout was supplied
in autoinstall, which makes it all the way to curthooks before failing
with an inscruitble and difficult to find error from ckbcomp.

Validate ahead of time these values.
2023-02-28 13:36:16 -07:00
Olivier Gayot b4090e30f6 filesystem: don't offer tiny partitions / disks as potential PVs
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-28 16:50:04 +01:00
Olivier Gayot b2d896c1d3
Merge pull request #1576 from ogayot/revert-tracemalloc
Revert "Enable tracemalloc in integration tests with at most 3 frames" to speed up integration tests
2023-02-27 09:25:27 +01:00
Carlos Nihelton 6914674e59
Attempts different ways to join
Even though AD joining is not that critical.
I noticed in lab higher success rates when not specifying the computer
name option in realm join CLI.
But I'm not convident enough to say that this would behave better than
Ubiquity's original implementation, which does use the computer name
option.
2023-02-25 17:10:07 -03:00
Olivier Gayot f55d3a6056 Revert "Enable tracemalloc in integration tests with at most 3 frames"
This reverts commit 813448683c.
2023-02-24 19:53:57 +01:00
Carlos Nihelton 0bd9e0723c
No timeouts in arun_command 2023-02-24 10:19:22 -03:00
Carlos Nihelton 03c80eb8a6
Realm doesn't need curtin
It turns out that the `realm --install /target` does a chroot.
So curtin in target command is not necessary for that.
The same doesn't hold for pam-auth-update.
Setting hostnames is still a requirement, because realm calls adcli
under the hood, which doesn't go through chroot.
2023-02-24 09:08:29 -03:00
Carlos Nihelton 5c059dd6ab
Wraps the hostname setting into a context manager
To have more deterministic set/reset behavior.
2023-02-24 08:57:05 -03:00
Carlos Nihelton 706359ea6f
Local-scope timeout in AD API tests
Timeout was triggered by the test timeout.
This puts a timeout on the single call that must timeout.
Potentially speeds up the test scenario.
2023-02-24 08:39:43 -03:00
Carlos Nihelton a5478feb8c
Merges unit tests into the controllers directory 2023-02-24 08:32:59 -03:00
Olivier Gayot 914abfd5a8
Merge pull request #1574 from ogayot/ci-no-apt-run-on-host
make sure mirror selection does not cause timeouts on CI
2023-02-23 19:25:00 +01:00
Olivier Gayot 75f6047a6f mirror: in CI, do not run apt-get update on the host
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-23 18:12:24 +01:00
Olivier Gayot e90e2b4e6a mirror: honor replay-timescale when sleeping between mirror candidates
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-23 18:10:56 +01:00
Carlos Nihelton 3a9fb2b132
Fix misplaced comment about the live hostname 2023-02-23 12:21:44 -03:00
Carlos Nihelton b8ca8af99f
Fix command name typo 2023-02-23 12:21:44 -03:00
Carlos Nihelton c756b15183
Tests some async invariants
There is a quite non-straightforward sequencing between the AD
controller and Joiner classes.

A client may do a blocking call to join_result_GET at any moment.
It should only be blocking if the ADModel is set.
Curtin commands are not tested here, though.
2023-02-23 12:21:43 -03:00
Carlos Nihelton 7f5466229b
Only block if the model is set for joining
Also, the model.do_join field was never set.
Now it is.
2023-02-23 12:21:43 -03:00
Carlos Nihelton ee1ac0493b
Use the command class fields 2023-02-23 12:21:42 -03:00
Carlos Nihelton af6c7f747e
Blocking API test 2023-02-23 12:21:42 -03:00
Carlos Nihelton 2cedf0f3f0
Attempts to join the target through curtin 2023-02-23 12:21:41 -03:00
Carlos Nihelton fc6facbc01
Split strategies for live and dry run. 2023-02-23 12:21:41 -03:00
Carlos Nihelton 823461cd25
Implement and connect the AdJoiner
AD controller offers the blockign endpoint.
AD Joiner creates a task when the AD Controller join_domain() is called.
Install controller requests that in the end of the post install method.
AD Controller calls itself on dry run for testing purposes

TODO:
  - refine tests;
  - do the real join.
2023-02-23 12:21:38 -03:00
Dan Bungert 84a4ab78c9
Merge pull request #1573 from dbungert/simpler-ver-compare
Revert "Compare the snaps versions to avoid suggesting a downgrade"
2023-02-23 07:05:19 -07:00
Dan Bungert 0766922a3b Revert "Compare the snaps versions to avoid suggesting a downgrade"
This reverts commit 2f9c7399ca.
2023-02-22 14:34:51 -07:00
Dan Bungert 9d5779891e
Merge pull request #1569 from dbungert/lp-2004659-has-network-try2
network: use pyroute2 to manage default routes
2023-02-21 13:51:46 -07:00
Dan Bungert 69bb8307eb network: do not accept route metric > 20000
Network manager can create routes at metric aka priority above 20000.
These can stick around if they are not the best choice, or they may
disappear quickly.

Do not consider one of these routes as a valid default route for
has_network purposes.
2023-02-21 13:30:05 -07:00
Dan Bungert e095d5040f network: use pyroute2 to manage default routes
The existing event based method of watching for has_network has a flaw.

The incoming route_change events from probert do not distinguish routes
on the same interface but a different metric, so if 2 routes on one
interface appear, we only get one event.  Then if one of those routes is
removed, we will inappropriately remove this route from the
default_routes list.

Aside from the code watching the event stream, the set of default routes
is an elaborate boolean value.

Simplify the code by passing around a boolean, and when we get a
route_change event, use that to go looking again at the list of default
routes.

LP: #2004659
2023-02-21 13:30:05 -07:00
Olivier Gayot a6f6c655e2
Merge pull request #1570 from ogayot/probert-size-fixes
snapcraft: update probert to get swap size fixes
2023-02-21 16:50:44 +01:00
Carlos Nihelton 236e56031e
Merge pull request #1571 from CarlosNihelton/ad-post-vs-get
Turns AD validation methods into POST
2023-02-20 17:34:54 -03:00
Carlos Nihelton 3946b04915
Turns AD validation methods into POST
they were GET.
Dart HTTP Client sets content length to 0 on GET by default.
That makes a bit harder programming on the client side.
2023-02-20 16:14:13 -03:00
Olivier Gayot 3d3a2aec4a snapcraft: update probert to get swap size fixes
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-20 16:42:58 +01:00