Commit Graph

6182 Commits

Author SHA1 Message Date
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
Carlos Nihelton b1f29c897f
Pinging the DC in the domain check endpoint
added one more error value to the enum
"ping" relies on realmd, which is part of the minimal layer.
For now not considering it coming from the snap.
The package is not staged at this point.
2023-02-16 09:19:32 -03:00
Carlos Nihelton 27e85717df
Merge pull request #1553 from CarlosNihelton/ad-validations-deeng-585
Active Directory API Part 2 - Validations on POST  🎉
2023-02-16 09:17:26 -03:00
Carlos Nihelton 80e395129d
Updates POST comment. 2023-02-16 08:42:16 -03:00
Carlos Nihelton a706b99478
re.escape at the regex compile call site. 2023-02-16 08:42:16 -03:00
Olivier Gayot 03f41c2f60 debconf-selections: pass to curtin's apt-config rather than curthooks
We got multiple bug reports in the past stating that the installer is
not honoring some part of the apt settings; either supplied by means of
autoinstall (e.g., pinning) or via the subiquity UI (e.g., proxy).

What happens under the hood is that curtin overwrites the APT settings
as part of the curthooks stage ; effectively discarding earlier settings
applied in the apt-config stage.

Curtin does so because we pass debconf_selections directives to
curthooks. In the past, curtin used to handle debconf_selections
separately but nowadays it considers that they are part of the APT
config. As a result, it decides to run apt-config again (but with a
close to empty configuration) as part of the curthooks stage.

We now pass debconf_selections as part of the apt-config stage. This
should hint curtin not to run apt-config again as part of curthooks.

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-16 12:08:40 +01:00
Olivier Gayot 6c3ae3c6dd mirror: add support for falling back to an offline install
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-15 18:09:39 +01:00
Olivier Gayot 10a2e6ac22 mirror: allow to combine different filters for the candidates
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-15 14:14:20 +01:00
Olivier Gayot 1350ef8d1b mirror: do not raise from POST /mirror if no usable mirror
Raising from the POST /mirror handler makes it difficult for the client
to distinguish an internal error from the lack of usable mirror.

We now return an enumeration with the following possible values:
 * ok
 * no-usable-mirror

It is up to the client to either:
 1. adjust the network settings and retry
 2. give up on the install

Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-15 11:35:31 +01:00
Olivier Gayot 4247846270 network: add override mechanism to force offline install
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2023-02-15 09:05:14 +01:00
Olivier Gayot 58e524ae6e
Merge pull request #1552 from ogayot/fallback-mirror
Support of multiple candidates mirrors with automatic selection in autoinstall & desktop installs
2023-02-15 09:04:11 +01:00
Dan Bungert 25aaf00792
Merge pull request #1541 from dbungert/more-fde-strings
More fde strings
2023-02-14 15:51:47 -07:00