(dry)
Check if /etc/network/interfaces.d/ is included as source-directory

    If the distribution doesn't have the `/etc/network/interface` directory,
    just return.
Check if /etc/network/interfaces.d/ is included as source-directory
Check if / etc / network / interfaces . d / is included as source - directory
def _check_debian_net_interfaces_d(dry):
    """Check if /etc/network/interfaces.d/ is included as source-directory

    If the distribution doesn't have the `/etc/network/interface` directory,
    just return.

    """
    if_file = "/etc/network/interfaces"

    if (not os.path.exists(if_file)):
        return

    if_dir = "/etc/network/interfaces.d/"
    src_line = "source /etc/network/interfaces.d/*"

    if (dry):
        util.fill_print(
            "Make sure directory \"{}\" is considered as source for network "
            "interface configurations. Check if your \"{}\" file contains "
            "the following line:".format(if_dir, if_file))
        print("\n{}\n".format(src_line))
        print("If not, add it.\n")
        return

    with open(if_file) as fd:
        current_cfg = fd.read()

    src_included = False
    for line in current_cfg.splitlines():
        if src_line in line:
            src_included = True
            break

    if (src_included):
        return

    with open(if_file, 'a') as fd:
        fd.write("\n" + src_line)
def _check_debian_net_interfaces_d ( dry ) : if_file = "/etc/network/interfaces" if ( not os . path . exists ( if_file ) ) : return if_dir = "/etc/network/interfaces.d/" src_line = "source /etc/network/interfaces.d/*" if ( dry ) : util . fill_print ( "Make sure directory \"{}\" is considered as source for network " "interface configurations. Check if your \"{}\" file contains " "the following line:" . format ( if_dir , if_file ) ) print ( "\n{}\n" . format ( src_line ) ) print ( "If not, add it.\n" ) return with open ( if_file ) as fd : current_cfg = fd . read ( ) src_included = False for line in current_cfg . splitlines ( ) : if src_line in line : src_included = True break if ( src_included ) : return with open ( if_file , 'a' ) as fd : fd . write ( "\n" + src_line )