Dryrun or config test option

Bug #1735318 reported by Joshua Powers
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Netplan
Triaged
Wishlist
Unassigned

Bug Description

Feature request for a --dryrun or config test option to validate 1) I have valid YAML and 2) the keys and values are consumable/readable by netplan. This is essentially what generate does, but stopping before generating part.

Use Case 1:

I am a new user of netplan and I do not know what I am doing. I am experimenting with netplan and I do not want to apply changes to my local system. I do however want to test my YAML to validate that netplan can parse it correctly.

Use Case 2:

I am a sys admin of lots of servers with more complex networking requirements where I am adding all sorts of vlan, bonding, bridging options. Before spending time checking on a system I want to write YAML on my local development system and know that netplan will read it without wasting time on syntax or incorrect keys.

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

Yes! This ties in to other future feature ideas too. Triaging.

Changed in netplan:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Jean-Daniel Dupas (xooloo) wrote :

Use Case 3:
  I'm a sysadmin with lots of server where network config is generated by scripts. Such scripts should be able to validate that the generated file is valid before deploying it.

Revision history for this message
Daniel Axtens (daxtens) wrote :

I think this is now provided by 'netplan try' in Bionic.

Does anyone object to this being marked as Fix Released?

Regards,
Daniel

Revision history for this message
Joshua Powers (powersj) wrote :

Use case 1 is covered by netplan try. Use case 2 and 3 are not.

Revision history for this message
Daniel Axtens (daxtens) wrote :

Usecase 2 can be covered with netplan generate --root-dir: create foo/etc/netplan, put the files in there, and do 'netplan generate --root-dir foo'. I think that might cover case 3 as well?

Revision history for this message
Joshua Powers (powersj) wrote :

I would have expected it to fail with a message about the incorrect YAML:
https://paste.ubuntu.com/p/dv3dgjjQVJ/

I also strongly dislike modifying my own system to test something I would want used on a different system.

Revision history for this message
Ryan Harper (raharper) wrote : Re: [Bug 1735318] Re: Dryrun or config test option

I think the netplan python wrapper needs help, what you can do is:

# /lib/netplan/generate -r test-dir test.yaml
Invalid YAML at test.yaml line 8 column 17: mapping values are not
allowed in this context
# echo $?
1
On Mon, Jul 23, 2018 at 4:11 PM Joshua Powers <email address hidden> wrote:
>
> I would have expected it to fail with a message about the incorrect YAML:
> https://paste.ubuntu.com/p/dv3dgjjQVJ/
>
> I also strongly dislike modifying my own system to test something I
> would want used on a different system.
>
> --
> You received this bug notification because you are subscribed to
> netplan.
> Matching subscriptions: netplan
> https://bugs.launchpad.net/bugs/1735318
>
> Title:
> Dryrun or config test option
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/netplan/+bug/1735318/+subscriptions

Revision history for this message
Daniel Axtens (daxtens) wrote :

OK, so we've basically landed in the territory of LP: #1701434.

I don't know if we want to just mark one of those as duplicates of the other, but clearly the python wrapper needs some more smarts around this.

I'll have a look and see if I can make some sense of the different failure modes and which need to be signalled back through the exit code of netplan apply.

Revision history for this message
Daniel Axtens (daxtens) wrote :

It looks like at least some of this changed between Bionic and Cosmic - here with a netplan 0.39:

root@netplan:~# netplan apply
Error in network definition /etc/netplan/50-cloud-init.yaml line 5 column 0: unknown key xxnetwork
root@netplan:~# echo $?
78

At the very least now generate gets an exit code. Do we just need to get this backported?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.