sysconfig renders BOOTPROTO=dhcp even if dhcp=false in v2 network-config

Bug #1818032 reported by Kurt Stieger on 2019-02-28
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cloud-init
High
Unassigned

Bug Description

Distribution: Fedora 29
Cloud Provider: None, NoCloud
Cloud-Init Version: 18.5 (also 17.1)

Network Config V2:
version: 2
ethernets:
  ens3:
    match:
      macaddress: 52:54:00:ab:cd:ef
    dhcp4: false
    dhcp6: false
    addresses:
      - 192.168.42.100/24
      - 2001:db8::100/32
    gateway4: 192.168.42.1
    gateway6: 2001:db8::1
    nameservers:
      search: [example.com]
      addresses: [192.168.42.53, 1.1.1.1]

Renders to /etc/sysconfig/network-scripts/ifcfg-ens3:

# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=dhcp
DEFROUTE=yes
DEVICE=ens3
DHCPV6C=yes
DNS1=192.168.42.53
DNS2=1.1.1.1
DOMAIN=example.com
GATEWAY=192.168.42.1
HWADDR=52:54:00:ab:cd:ef
IPADDR=192.168.42.101
IPV6ADDR=2001:db8::101/32
IPV6INIT=yes
IPV6_DEFAULTGW=2001:db8::1
NETMASK=255.255.255.0
NM_CONTROLLED=no
ONBOOT=yes
STARTMODE=auto
TYPE=Ethernet
USERCTL=no

But 'BOOTPROTO=dhcp' should be 'BOOTPROTO=none' and 'DHCPV6C=yes' should be 'DHCPV6C=no' or missing.

Already fixed this: https://code.launchpad.net/~kurt-easygo/cloud-init/+git/cloud-init/+merge/363732

Related branches

Kurt Stieger (kurt-easygo) wrote :
Ryan Harper (raharper) on 2019-02-28
Changed in cloud-init:
importance: Undecided → High
status: New → Confirmed
Ryan Harper (raharper) wrote :

I verified the error with the supplied config in this bug.

% cat network_configs/fedora29-netplan-dhcp.yaml
network:
  version: 2
  ethernets:
    ens3:
      match:
        macaddress: 52:54:00:ab:cd:ef
      dhcp4: false
      dhcp6: false
      addresses:
        - 192.168.42.100/24
        - 2001:db8::100/32
      gateway4: 192.168.42.1
      gateway6: 2001:db8::1
      nameservers:
        search: [example.com]
        addresses: [192.168.42.53, 1.1.1.1]
(neipa) cloud-init % PYTHONPATH=`pwd` python3 cloudinit/cmd/main.py devel net-convert --debug --network-data network_configs/fedora29-netplan-dhcp.yaml --kind yaml -O sysconfig --distro fedora -d fedora_test

After apply your suggested patch, this resolve the issue.

% diff -u fedora_test/etc/sysconfig/network-scripts/ifcfg-ens3 fedora_test_fix/etc/sysconfig/network-scripts/ifcfg-ens3
--- fedora_test/etc/sysconfig/network-scripts/ifcfg-ens3 2019-02-28 11:42:06.313736619 -0600
+++ fedora_test_fix/etc/sysconfig/network-scripts/ifcfg-ens3 2019-02-28 11:46:42.839672661 -0600
@@ -1,9 +1,8 @@
 # Created by cloud-init on instance boot automatically, do not edit.
 #
-BOOTPROTO=dhcp
+BOOTPROTO=none
 DEFROUTE=yes
 DEVICE=ens3
-DHCPV6C=yes
 DNS1=192.168.42.53
 DNS2=1.1.1.1
 DOMAIN=example.com

This bug is fixed with commit bd35300b to cloud-init on branch master.
To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=bd35300b

Changed in cloud-init:
status: Confirmed → Fix Committed

This bug is believed to be fixed in cloud-init in version 19.1. If this is still a problem for you, please make a comment and set the state back to New

Thank you.

Changed in cloud-init:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers