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
J-P Nurmi
10833a848f
network: reset SNAP when calling netplan in dry-run mode
2023-02-08 17:49:57 +01:00
Olivier Gayot
f0e5c19ee7
loop: replace use of asyncio.get_event_loop
...
The behavior of asyncio.get_event_loop() will change in a future Python
version. It is deprecated starting Python 3.10.
The functions that we can use instead are:
* asyncio.new_event_loop() - which creates a new event loop
* asyncio.get_running_loop() - which returns the event loop only if it
is already running
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-10-07 18:45:11 +02:00
Dan Bungert
9e0a90fc22
network: use routes instead of gateway directives
2022-09-06 16:44:12 -06:00
Dan Bungert
4b1277ae2d
console-conf: fix crash on network info
...
If you run dryrun for console-conf, go to the network page, go to an
interface, then info, a crash of the form
TypeError: object str can't be used in 'await' expression
can be seen. The signature for the core version of get_info_for_netdev
is not async, but a non-async method returning str.
So mark the core version of the function async.
Co-authored-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
2022-03-14 15:09:23 -06:00
Olivier Gayot
812bba1de1
Use logger names consistent with directory structure
...
Refreshed name of loggers to make them consistent with the directory
structure.
Signed-off-by: Olivier Gayot <olivier.gayot@canonical.com>
2022-02-25 17:35:45 +01:00
Dan Bungert
b7349241a9
standardize on useage of file_util methods
2022-02-14 11:14:10 -07:00
Dan Bungert
0f9c9eef3f
options: add output_base for dryrun use
...
To enable parallel API testing, add an output_base argument to replace
the default '.subiquity' that is sprinkled everywhere.
2022-01-26 10:39:23 -07:00
Dan Bungert
a005418cde
pubsub: split channels into two classes
2021-09-08 18:33:57 -06:00
Dan Bungert
0ea8139f32
MessageHub: Switch to using enum constants
2021-09-08 18:33:57 -06:00
Michael Hudson-Doyle
7b3bb0278b
fix some more assorted small wlan problems
2021-06-09 15:28:06 +12:00
Michael Hudson-Doyle
d14fd35330
move "enabling wifi turns on dhcp4" behaviour to controller from view
2021-06-02 12:40:50 +12:00
Michael Hudson-Doyle
902c57f7f7
move start_scan error handling into controller
...
report errors via scan_state field
2021-06-02 12:28:44 +12:00
Michael Hudson-Doyle
b84fa27752
call apply_config in controller set_wlan method
2021-06-02 12:28:44 +12:00
Michael Hudson-Doyle
dab04bcb3a
simple replacement for urwid signals wrapper as used in server
...
I think this removes all use of urwid from the server code.
2021-04-13 09:41:43 +12:00
Michael Hudson-Doyle
007dd3e5ef
tidy up answers handling a bit and fix a race
2020-12-16 10:21:32 +13:00
Michael Hudson-Doyle
93b8998af6
split NetworkController into non-ui and ui-focused classes
2020-10-12 12:05:56 +13:00
Michael Hudson-Doyle
d6f3f83622
run network answers in run_answers
2020-10-12 11:58:08 +13:00
Michael Hudson-Doyle
287b4492e8
start to factor out bits of networkcontroller that touch the view
2020-10-12 11:47:48 +13:00
Michael Hudson-Doyle
798a9da563
have answers code wait for nic creation/deletion to take effect
...
the UI will not be quite so synchronous in the client/server world
2020-10-12 11:25:50 +13:00
Michael Hudson-Doyle
8dc31a3c6b
change network answers processing to not reference model directly
2020-10-12 11:22:08 +13:00
Michael Hudson-Doyle
f89b9e692a
asyncioify "fine grained action" handling a bit
2020-10-12 11:16:38 +13:00
Michael Hudson-Doyle
f0082c2068
change controller api to return a view, rather than setting it
2020-09-18 11:44:00 +12:00
Michael Hudson-Doyle
88821f745c
Merge pull request #822 from mwhudson/network-simpler-types
...
make network view use a plain-old-data view of a nic
2020-09-18 09:54:13 +12:00
Michael Hudson-Doyle
f4066d97d7
convert controller api methods to take strings and trigger updates for affected nics
...
this is going to work better in the client/server world
2020-09-03 22:52:31 +12:00
Michael Hudson-Doyle
04426cec15
make network view use a plain-old-data view of a nic
...
The network view code used to crawl all over the network model object,
which isn't really going to work with the upcoming client/server split.
So this adds a much better defined interface between the view and
controller.
2020-09-03 11:12:38 +12:00
Michael Hudson-Doyle
edc65dbbfb
make the base controller have no ui, add subclass for one that has ui
2020-08-23 23:18:28 +12:00
Michael Hudson-Doyle
97b5c64805
do not crash in NetworkController._data_ready if ui.body is not a widgetwrap
...
for https://bugs.launchpad.net/subiquity/+bug/1881887
2020-06-12 15:01:58 +12:00
Michael Hudson-Doyle
c523e21c34
update wlan dialog when scan results come in
2020-05-19 11:53:03 +12:00
Michael Hudson-Doyle
e588d6475f
do not log wifi passwords from existing configs
2020-05-19 07:47:33 +12:00
Michael Hudson-Doyle
4e3996f3f8
improve with_context helper a bit, use it more
...
the decorated function must now be called with keyword arguments
2020-05-05 16:20:03 +12:00
Michael Hudson-Doyle
4891d76aca
actually write the netplan from the autoinstall config to the target system
...
I got lost in a forest of similarly named methods :(
2020-05-04 19:37:43 +12:00
Michael Hudson-Doyle
bc37b2c628
add a helper to make it easier to next contexts appropriately
...
i want this to help debug another branch i am working on!
2020-05-04 18:44:47 +12:00
Michael Hudson-Doyle
37a62f21aa
fix travis some more
2020-04-30 20:56:09 +12:00
Michael Hudson-Doyle
b66ad552f8
make default_netplan valid, for some reason this causes issues sometimes on travis
2020-04-30 20:25:14 +12:00
Michael Hudson-Doyle
81b6f8a90a
if netplan apply fails show an error rather than crashing the ui
2020-04-07 12:16:53 +12:00
Michael Hudson-Doyle
4101440814
a bigger hammer
2020-04-03 13:47:29 +13:00
Michael Hudson-Doyle
cab565304a
write netplan directly to the target
...
rather than via curtin and then cloud-init
2020-04-01 19:37:02 +13:00
Michael Hudson-Doyle
d717375d9c
apply network autoinstall config
2020-03-31 15:58:18 +13:00
Dimitri John Ledkov
d97bf081ea
Only delete virtual devices when config has changed
2020-03-26 21:26:34 +00:00
Michael Hudson-Doyle
cc52bb62a5
fix enabling dhcp on a virtual interface
2020-03-20 09:17:29 +13:00
Michael Hudson-Doyle
45478b68a4
add a way to change the default level of a context's children
2019-12-20 09:47:38 +13:00
Michael Hudson-Doyle
4be25fc78f
log applying network config via context
2019-12-20 09:47:36 +13:00
Michael Hudson-Doyle
fa39f10651
fix answers
2019-12-20 09:46:26 +13:00
Michael Hudson-Doyle
0c268f6c22
fix case where NIC does not get DHCP address
2019-12-19 16:06:56 +13:00
Michael Hudson-Doyle
ca1635a1f9
a bit of refactoring
2019-12-17 15:05:17 +13:00
Michael Hudson-Doyle
29c9f0878b
indent a "raise" properly
2019-12-17 11:28:42 +13:00
Michael Hudson-Doyle
2765e6a773
replace next-screen/prev-screen signals with method calls
2019-12-16 23:02:03 +13:00
Michael Hudson-Doyle
4e1afd60a4
do not always stop networkd
2019-12-13 10:04:57 +13:00