(ifname, addr_with_prefix)
Create configuration file at /etc/netplan/
Create configuration file at /etc/netplan/
Create configuration file at / etc / netplan /
def _add_to_netplan(ifname, addr_with_prefix):
    """Create configuration file at /etc/netplan/"""
    assert ("/" in addr_with_prefix)
    cfg_dir = "/etc/netplan/"

    cfg = ("network:\n"
           "  version: 2\n"
           "  renderer: networkd\n"
           "  ethernets:\n"
           "    {0}:\n"
           "      dhcp4: no\n"
           "      optional: true\n"
           "      addresses: [{1}]\n").format(ifname, addr_with_prefix)

    fname = "blocksat-" + ifname + ".yaml"
    path = os.path.join(cfg_dir, fname)

    if (runner.dry):
        util.fill_print("Create a file named {} at {} and add the "
                        "following to it:".format(fname, cfg_dir))
        print(cfg)
        return

    runner.create_file(cfg, path, root=True)
def _add_to_netplan ( ifname , addr_with_prefix ) : assert ( "/" in addr_with_prefix ) cfg_dir = "/etc/netplan/" cfg = ( "network:\n" "  version: 2\n" "  renderer: networkd\n" "  ethernets:\n" "    {0}:\n" "      dhcp4: no\n" "      optional: true\n" "      addresses: [{1}]\n" ) . format ( ifname , addr_with_prefix ) fname = "blocksat-" + ifname + ".yaml" path = os . path . join ( cfg_dir , fname ) if ( runner . dry ) : util . fill_print ( "Create a file named {} at {} and add the " "following to it:" . format ( fname , cfg_dir ) ) print ( cfg ) return runner . create_file ( cfg , path , root = True )