Commit graph

10 commits

Author SHA1 Message Date
Thomas Haller
c0b2430144 module: minor cleanup of Util.GMainLoop_run()
It was rather confusing whether the boolean return value meant
that the timeout was reached or the opposite.

Rename the internal variable, I think now it's quite clear.
2019-01-10 14:39:15 +01:00
Till Maas
6fc00a0d43 Make connections volatile instead of removing them
This keeps the profile up in Network Manager for
persistent_state:absent.
2019-01-10 14:39:15 +01:00
Thomas Haller
b4972517a4 module: fix name for ArgValidator_DictConnection
The name is actually not ever used, because
ArgValidator_DictConnection() is never validated directly.
Instead, it is always nested inside ArgValidator_ListConnections()
which passes "connections[$IDX]" as name to self.nested._validate().

Anyway, still when looking at the name of a ArgValidator_DictConnection
instance, it makes slightly more sense to call it just "connection".
2018-10-10 15:20:25 +02:00
Thomas Haller
97e216c716 module: don't expose "name" parameter for ArgValidator.validate()
The "name" argument is an implementation detail, that is used
by ArgValidatorDict and ArgValidatorList to pass a complex (nested)
name of what is currently parsed.

Callers are not supposed to see or use this argument.
Hide it, by adding an internal helper method _validate().
2018-10-10 15:20:25 +02:00
Thomas Haller
6856b5407d module: rename internal ArgValidator._validate()
First a trivial renaming because the next commit will
add a different "_validate" method.
2018-10-10 15:20:25 +02:00
Thomas Haller
8daa14eb36 module: make Utils.create_uuid() working without pygobject
Utils.create_uuid() only needs the "uuid" module, which
is commonly available. Don't load it together with the
NM module, as that requires pygobject.
2018-10-10 15:20:25 +02:00
Till Maas
09258d84e3 Support compatibility values for 'state' setting 2018-08-15 10:04:47 +02:00
Till Maas
23605615da Separate 'persistent_state' from 'state'
- persistent_state represents whether a profile is stored on disk
- persistent_state defaults to 'present'
- When there is no type specified for the profile, it is enough for a
profile with the same name to be stored on the target's systems file
system. Otherwise the role will fail
- state now represents the runtime state and can be up, down or
unspecified
- translate the state definitions into actions that will be performed.
The actions correspond to the previous states.
- add the possibility to write unit tests to only verify parts of the
resulting connection dictionary to only check for the expected changes
instead of the full connection that can also contain unrelated defaults
2018-08-15 10:04:47 +02:00
Till Maas
d76ac65581 Do not require profiles to be specified for 'up'
This allows to up profiles that are only available on disk.
2018-08-15 10:04:47 +02:00
Till Maas
382c34197b Modularize role
Splitting the role in smaller parts helps to keep the overview and to
develop separate tests.
2018-08-15 10:04:47 +02:00