Commit Graph

5692 Commits

Author SHA1 Message Date
Carlos Nihelton 2057dcd64a
Consistent naming - part 1 - AdModel
No other class starts with both capitals 'AD'.
2023-03-02 09:39:53 -03:00
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
Olivier Gayot 42daf4be3a
Merge pull request #1567 from ogayot/source-partial-autoinstall
source: honor source if hinted by autoinstall but interactive
2023-02-20 09:45:05 +01:00
Dan Bungert 8d9ad23ca6
Merge pull request #1566 from dbungert/lp-2007554-async-parameterized
tests: patch parameterized to handle async
2023-02-18 18:48:06 -07:00
Carlos Nihelton bf603d3b3e
Merge pull request #1568 from CarlosNihelton/ad-enhancements-deeng-596
Active Directory API UX Enhancements
2023-02-18 00:12:16 -03:00
Carlos Nihelton b60305edb2
Replaces raw asyncio.create_task
`run_bg_task` is the default recommendation instead.
2023-02-17 23:19:01 -03:00
Carlos Nihelton 9b50c8db07
Auto discover the domain at start
`realm discover` without a domain name attempts to find one from DHCP.
This attempts to run it from the controller start method.
Only creates the discover task if there is support
Avoids exception on controller start.
2023-02-17 14:27:05 -03:00
Carlos Nihelton a37b5e3870
Check for the needed programs in the live system
Currently only the realm program is executed by the ad controller.
Thus we only check if its accessible.

Clients should call this endpoint prior to showing the AD screen.
2023-02-17 14:21:31 -03:00
Carlos Nihelton 4266a5e642
Merge pull request #1563 from CarlosNihelton/ad-ping-deeng-586
Active Directory API Part 3 - Pinging the Domain Controller
2023-02-17 14:09:19 -03:00
Olivier Gayot 1fa408aa75 source: honor source if hinted by autoinstall but interactive
If a specific source ID is set via autoinstall but the source controller
is marked interactive, the UI would select the default source (i.e., the
first one on the list) instead of the one matching the ID specified.

This happens because the matching between the ID and the sources loaded
was done in apply_autoinstall_config ; which is only called in
non-interactive scenarios.

By moving this matching in the start coroutine instead, the right source
is also selected when the source controller is interactive.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-17 15:40:58 +01:00
Dan Bungert f9ce25f15f tests: patch parameterized to handle async
parameterized async tests run into cpython bug gh-101486

We use parameterized.expand, which works by creating new functions and
inserting those into the list of tests.  It's a wonder this worked at
all before for the async tests.

Update the function generation to create a coroutine function, if
appropriate.

LP: #2007554
2023-02-16 19:17:37 -07:00
Olivier Gayot 9ed734b48b
Merge pull request #1564 from ogayot/fallback-offline
Optionally fallback to offline install if no usable mirror provided
2023-02-16 18:45:05 +01:00