#!/usr/bin/env python3

#import setup
#setup.pre_install()
import os, sys
sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))
from charmhelpers.core import (
   hookenv,
   host
)

def install():
    hookenv.log('Installing dns')
    os.system('apt-get update')
    os.system('apt-get upgrade -y')
    os.system('apt-get dist-upgrade -y')
    os.system('apt install network-manager -y')
    os.system('apt-get install -y bind9 bind9utils bind9-doc')
    hookenv.log('DNS Installed')
    # add steps for installing dependencies and packages here
    # e.g.: from charmhelpers import fetch
    #       fetch.apt_install(fetch.filter_installed_packages(['nginx']))

    hookenv.status_set('active', 'Ready')
    hookenv.open_port(53, protocol='UDP')
if __name__ == "__main__":
    install()
