Example #1
0
def undo_default_configuration(client):

    try:
        platform_root, err = config.get_platform_root()
        if err:
            raise Exception(err)
        defaults_dir, err = config.get_defaults_dir()
        if err:
            raise Exception(err)

        try:
            os.remove('%s/master.status' % platform_root)
        except OSError:
            pass

        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'rm /etc/ntp.conf'], expr_form='grain')

        print "Unlinking CTDB files"
        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'rm /etc/sysconfig/ctdb'], expr_form='grain')
        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'rm /etc/ctdb/nodes'], expr_form='grain')

        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'rm /etc/samba/smb.conf'], expr_form='grain')
        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'rm /etc/rc.local'], expr_form='grain')
        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'cp %s/salt/master /etc/salt' % defaults_dir])
        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'cp %s/salt/minion /etc/salt' % defaults_dir])

    except Exception, e:
        return False, 'Error undoing the default configuration : %s' % str(e)
def configure_minion(*masters):
    try:
        if not masters:
            raise Exception('No masters specified')
        if len(masters) > len(set(masters)):
            raise Exception('Duplicate masters specified')

        platform_root, err = config.get_platform_root()
        if err:
            raise Exception(err)

        f1 = open('%s/defaults/salt/minion_part_1' % platform_root, 'r')
        f2 = open('%s/defaults/salt/minion_part_2' % platform_root, 'r')

        with open('/tmp/minion', 'w') as fw:
            fw.write(f1.read())
            if len(masters) > 1:
                fw.write('master:\n')
                for master in masters:
                    fw.write('  - %s\n' % master)
            else:
                fw.write('master: %s\n' % masters[0])
            fw.write('\n')
            fw.write(f2.read())
        f2.close()
        f1.close()
        shutil.move('/tmp/minion', '/etc/salt/minion')

        # Record the new masters so that they can be used by other scripts like
        # rc.local
        with open('%s/admin_gridcells' % platform_root, 'w') as f:
            for master in masters:
                f.write('%s\n' % master)

        # Flag the node as being a part of the salt grid..
        with open('%s/part_of_grid' % platform_root, 'w') as f:
            f.write(time.strftime("%Y-%m-%d %H:%M:%S"))

    except Exception, e:
        return False, str(e)
def configure_minion(*masters):
    try:
        if not masters:
            raise Exception('No masters specified')
        if len(masters) > len(set(masters)):
            raise Exception('Duplicate masters specified')

        platform_root, err = config.get_platform_root()
        if err:
            raise Exception(err)

        f1 = open('%s/defaults/salt/minion_part_1' % platform_root, 'r')
        f2 = open('%s/defaults/salt/minion_part_2' % platform_root, 'r')

        with open('/tmp/minion', 'w') as fw:
            fw.write(f1.read())
            if len(masters) > 1:
                fw.write('master:\n')
                for master in masters:
                    fw.write('  - %s\n' % master)
            else:
                fw.write('master: %s\n' % masters[0])
            fw.write('\n')
            fw.write(f2.read())
        f2.close()
        f1.close()
        shutil.move('/tmp/minion', '/etc/salt/minion')

        # Record the new masters so that they can be used by other scripts like
        # rc.local
        with open('%s/admin_gridcells' % platform_root, 'w') as f:
            for master in masters:
                f.write('%s\n' % master)

        # Flag the node as being a part of the salt grid..
        with open('%s/part_of_grid' % platform_root, 'w') as f:
            f.write(time.strftime("%Y-%m-%d %H:%M:%S"))

    except Exception, e:
        return False, str(e)
Example #4
0
def configure_minion():

    try:
        os.system('clear')
        minion_opts = salt.config.minion_config('/etc/salt/minion')
        masters = []
        if minion_opts and 'master' in minion_opts:
            masters = minion_opts['master']

        masters_list = []
        if type(masters) is not list:
            masters_list.append(masters)
        else:
            masters_list = masters

        print '\n\n\nBootstrap admin agent\n'
        print '----------------------\n\n\n'
        config_changed = False
        str_to_print = 'Enter the IP address of the initial Admin GRIDCell : '

        valid_input = False
        ip = None
        while not valid_input:
            input = raw_input(str_to_print)
            if input:
                vi, err = networking.validate_ip(input.strip())
                if err:
                    raise Exception(err)
                if vi:
                    ip = input.strip()
                    valid_input = True
                else:
                    print "Invalid value. Please try again."
            else:
                print "Invalid value. Please try again."
            print

        print "Final confirmation"
        print "------------------"

        print
        print "You have entered : %s" % input
        print

        str_to_print = 'Commit the above changes? (y/n) :'

        commit = 'n'
        valid_input = False
        while not valid_input:
            input = raw_input(str_to_print)
            if input:
                if input.lower() in ['y', 'n']:
                    valid_input = True
                    commit = input.lower()
            if not valid_input:
                print "Invalid value. Please try again."
        print

        if commit == 'y':
            print "Committing changes!"
        else:
            print "Discarding changes!"

        if commit == 'y':
            platform_root, err = config.get_platform_root()
            if err:
                raise Exception(err)

            f1 = open('%s/defaults/salt/minion_part_1' % platform_root, 'r')
            f2 = open('%s/defaults/salt/minion_part_2' % platform_root, 'r')
            with open('/tmp/minion', 'w') as fw:
                fw.write(f1.read())
                fw.write('master: %s\n' % ip)
                fw.write('\n')
                fw.write(f2.read())
            f2.close()
            f1.close()
            shutil.move('/tmp/minion', '/etc/salt/minion')
            print
            print 'Restarting admin agent service'
            (r,
             rc), err = command.execute_with_rc('service salt-minion restart')
            if err:
                raise Exception(err)
            if rc == 0:
                print "Admin agent (salt minion) service restarted succesfully."
            else:
                raise Exception(
                    "Error restarting admin agent (salt minion) services.")

    except Exception, e:
        print "Error configuring network settings : %s" % e
        return -1
def configure_minion():

    try:
        os.system('clear')
        minion_opts = salt.config.minion_config('/etc/salt/minion')
        masters = []
        if minion_opts and 'master' in minion_opts:
            masters = minion_opts['master']

        masters_list = []
        if type(masters) is not list:
            masters_list.append(masters)
        else:
            masters_list = masters

        print '\n\n\nBootstrap admin agent\n'
        print '----------------------\n\n\n'
        config_changed = False
        str_to_print = 'Enter the IP address of the initial Admin GRIDCell : '

        valid_input = False
        ip = None
        while not valid_input:
            input = raw_input(str_to_print)
            if input:
                vi, err = networking.validate_ip(input.strip())
                if err:
                    raise Exception(err)
                if vi:
                    ip = input.strip()
                    valid_input = True
                else:
                    print "Invalid value. Please try again."
            else:
                print "Invalid value. Please try again."
            print

        print "Final confirmation"
        print "------------------"

        print
        print "You have entered : %s" % input
        print

        str_to_print = 'Commit the above changes? (y/n) :'

        commit = 'n'
        valid_input = False
        while not valid_input:
            input = raw_input(str_to_print)
            if input:
                if input.lower() in ['y', 'n']:
                    valid_input = True
                    commit = input.lower()
            if not valid_input:
                print "Invalid value. Please try again."
        print

        if commit == 'y':
            print "Committing changes!"
        else:
            print "Discarding changes!"

        if commit == 'y':
            platform_root, err = config.get_platform_root()
            if err:
                raise Exception(err)

            f1 = open('%s/defaults/salt/minion_part_1' % platform_root, 'r')
            f2 = open('%s/defaults/salt/minion_part_2' % platform_root, 'r')
            with open('/tmp/minion', 'w') as fw:
                fw.write(f1.read())
                fw.write('master: %s\n' % ip)
                fw.write('\n')
                fw.write(f2.read())
            f2.close()
            f1.close()
            shutil.move('/tmp/minion', '/etc/salt/minion')
            print
            print 'Restarting admin agent service'
            (r, rc), err = command.execute_with_rc(
                'service salt-minion restart')
            if err:
                raise Exception(err)
            if rc == 0:
                print "Admin agent (salt minion) service restarted succesfully."
            else:
                raise Exception(
                    "Error restarting admin agent (salt minion) services.")

    except Exception, e:
        print "Error configuring network settings : %s" % e
        return -1
# Django settings for integral_view project.
from integralstor_utils import config
import os

DEBUG = True
ALLOWED_HOSTS = ['*']

APP_DEBUG = False


LOGIN_URL = '/login/'

platform_root, err = config.get_platform_root()
#DB_LOCATION, err = config.get_db_path()
STATIC_DIR_PATH = '%s/integral_view/static' % platform_root
TEMPLATE_DIR_PATH = "%s/integral_view/templates" % platform_root

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS


DATABASES = {
    'default': {
        # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
Example #7
0
def initiate_setup():

    client = None
    si = None
    admin_gridcells = []

    try:
        client = salt.client.LocalClient()
        me = socket.getfqdn()

        do = raw_input("Scan for and accept admin GRIDCells?")
        if do == 'y':
            # Get the hostnames of the three gridcells to be flagged as admin
            # gridcells
            admin_gridcells, err = get_admin_gridcells()
            if err:
                raise Exception(err)

            # Accept their keys, get their bond0 IP, add them to the hosts
            # file(DNS), sync modules, regenrate manifest and status, update
            # the minions to point to the admin gridcells, flag them as admin
            # gridcells by setting the appropriate grains and restart the
            # minions.
            (success, failed), err = grid_ops.add_gridcells_to_grid(None, admin_gridcells, admin_gridcells,
                                                                    first_time=True, print_progress=True, admin_gridcells=True, restart_salt_minions=False, establish_cron=False)
            # print success, failed, err
            if err:
                raise Exception(err)
            if (not success):
                raise Exception(
                    'Error adding GRIDCells to grid : Unknown error')
            else:
                print 'Successfully added the following GRIDCells to the grid : %s' % ','.join(success)

            if failed:
                raise Exception('Error adding %s to the grid. Error : ' % (
                    ','.join(failed), err))

        print "Loading GRIDCell information"

        si, err = system_info.load_system_config(first_time=True)
        if not si:
            raise Exception("Error loading GRIDCell information : %s" % err)

        print "Loading GRIDCell information...Done."
        print

        # Create the gluster trusted storage pool
        do = raw_input("Create the distributed storage pool?")
        if do == 'y':
            print 'Creating the distributed storage pool.'
            for admin_gridcell in admin_gridcells:
                if admin_gridcell != me:
                    d, err = gluster_trusted_pools.add_a_gridcell_to_gluster_pool(
                        admin_gridcell)
                    if err:
                        raise Exception(err)
            print 'Creating the distributed storage pool.. Done.'
            print

        # Create and start the admin volume
        do = raw_input("Create the admin volume?")
        if do == 'y':
            rc, err = grid_ops.create_admin_volume(client, admin_gridcells)
            if not rc:
                if err:
                    raise Exception(err)
                else:
                    raise Exception(
                        'Error creating admin volume : unknown error')

        do = raw_input("Mount the admin volume?")
        if do == 'y':
            sleep(10)
            print "Mounting the IntegralStor Administration volume.."
            rc, err = grid_ops.mount_admin_volume(client, admin_gridcells)
            if not rc:
                e = None
                if err:
                    e = "Error mounting admin vol : %s" % err
                else:
                    e = "Error mounting admin vol"
                raise Exception(e)
            print "Mounting the IntegralStor Administration volume.. Done."
            print

        do = raw_input("Create the default configuration?")
        if do == 'y':
            sleep(10)
            # Create all the required directories and link them to the
            # appropriate places and setup CTDB and NTP as well.
            print
            print "Establishing the default IntegralStor configuration .."
            rc, err = establish_default_configuration(
                client, si, admin_gridcells)
            if not rc:
                if err:
                    raise Exception(err)
                else:
                    raise Exception('Unknown error')
            print "Establishing the default IntegralStor configuration .. Done"
            print

        do = raw_input("Start services?")
        if do == 'y':
            sleep(10)
            # Start CTDB, samba and winbind on the nodes..
            print "Starting services.."
            rc, err = grid_ops.start_or_stop_services(
                client, admin_gridcells, 'start')
            if not rc:
                e = None
                if err:
                    e = "Error starting services on the GRIDCells : %s" % err
                else:
                    e = "Error starting services on the GRIDCells"
                raise Exception(e)
            print "Starting services.. Done."
            print

            rc = client.cmd('*', 'cmd.run_all', ['service uwsgi start'])
            if rc:
                for node, ret in rc.items():
                    if ret["retcode"] != 0:
                        errors = "Error restarting uwsgi service on %s" % node
                        print errors

        do = raw_input("Enable(chkconfig) services at startup?")
        if do == 'y':
            # Start CTDB, samba and/or winbind on the nodes..
            print "Enabling services.."
            rc, error = grid_ops.chkconfig_services(
                client, admin_gridcells, 'on')
            if not rc:
                e = None
                if err:
                    e = "Error enabling(chkconfig) services on the GRIDCells : %s" % err
                else:
                    e = "Error enabling(chkconfig) services on the GRIDCells"
                raise Exception(e)
            print "Enabling services.. Done."
            print

        do = raw_input("Setup cron on the admin GRIDCells?")
        if do == 'y':
            print
            print "Establishing the cron on the admin GRIDCells.."
            rc, err = grid_ops.setup_cron(
                client, admin_gridcells, admin_gridcells=True)
            if not rc:
                if err:
                    raise Exception(err)
                else:
                    raise Exception('Unknown error')
            print "Establishing the cron on the admin GRIDCells.. Done."
            print

        do = raw_input("Setup high availability for the admin service?")
        if do == 'y':
            print "\nSetting up high availability for the admin service.."
            print

            # Create the pki directory in the admin dir so all admin gridcells
            # can point to it..
            os.makedirs(
                '/opt/integralstor/integralstor_gridcell/config/salt/pki')
            distutils.dir_util.copy_tree(
                '/etc/salt/pki/master', '/opt/integralstor/integralstor_gridcell/config/salt/pki/master')

            others = []
            for admin_gridcell in admin_gridcells:
                if admin_gridcell != me:
                    others.append(admin_gridcell)

            print 'Sharing the admin master keys'
            rc = client.cmd(others, 'cmd.run_all', [
                            'yes | cp -rf /opt/integralstor/integralstor_gridcell/config/salt/pki/master /etc/salt/pki/master'], expr_form='list')
            if rc:
                for node, ret in rc.items():
                    if ret["retcode"] != 0:
                        errors = "Error restoring master config on %s from admin vol " % node
                        print errors
            print 'Sharing the admin master keys.. Done.'
            print

            print 'Configuring the admin service to use the admin vol.'
            rc = client.cmd(
                '*', 'cmd.run_all', ['yes | cp /opt/integralstor/integralstor_gridcell/defaults/salt/master /etc/salt/master'])
            if rc:
                for node, ret in rc.items():
                    if ret["retcode"] != 0:
                        errors = "Error copying the master config on %s" % node
                        print errors
            print 'Configuring the admin service to use the admin vol.. Done.'
            print

            print 'Restarting the admin master service'
            #rc = client.cmd('*','cmd.run_all',['service salt-master restart'])
            rc = client.cmd(others, 'cmd.run_all', [
                            'service salt-master restart'], expr_form='list')
            if rc:
                for node, ret in rc.items():
                    if ret["retcode"] != 0:
                        errors = "Error restarting salt-master on %s" % node
                        print errors
            print 'Restarting the admin master service.. Done.'
            print

            sleep(10)
            print 'Scheduling restarting of the admin slave service'
            #rc = client.cmd('*','cmd.run_all',['service salt-minion restart'])
            rc = client.cmd(
                '*', 'cmd.run_all', ['echo service salt-minion restart | at now + 1 minute'])
            if rc:
                for node, ret in rc.items():
                    if ret["retcode"] != 0:
                        errors = "Error restarting salt-minion service on %s" % node
                        print errors
            print 'Restarting the admin slave service.. Done.'
            print

            print "Setting up high availability for the admin service.. Done."
            print

        platform_root, err = config.get_platform_root()
        if err:
            raise Exception(err)

        with open('%s/first_time_setup_completed' % platform_root, 'w') as f:
            f.write('%s' % strftime("%Y-%m-%d %H:%M:%S"))

        do = raw_input("Restart salt master?")
        if do == 'y':
            command.get_command_output('service salt-master restart')

    except Exception, e:
        print '----------------ERROR----------------------'
        print 'Error setting up the GRIDCell system : %s.\n\n We will now undo the setup that has been done do far' % str(e)
        print '----------------ERROR----------------------'
        print
        undo_setup(client, si, admin_gridcells)
        return False, 'Error setting up the GRIDCell system : %s' % str(e)
Example #8
0
def establish_default_configuration(client, si, admin_gridcells):
    try:

        platform_root, err = config.get_platform_root()
        if err:
            raise Exception(err)

        defaults_dir, err = config.get_defaults_dir()
        if err:
            raise Exception(err)
        config_dir, err = config.get_config_dir()
        if err:
            raise Exception(err)
        ss_path, err = config.get_system_status_path()
        if err:
            raise Exception(err)
        tmp_path, err = config.get_tmp_path()
        if err:
            raise Exception(err)

        print "\nCopying the default configuration onto the IntegralStor administration volume."
        shutil.copytree("%s/db" % defaults_dir, "%s/db" % config_dir)

        # Create integral view DB
        ret, err = command.get_command_output('rm -rf %s/db/integral_view_config.db' % config_dir, shell=True)
        if err:
            pass
        ret, err = command.get_command_output('sqlite3 %s/db/integral_view_config.db < %s/db/integral_view_config.schema' % (config_dir,config_dir), shell=True)
        if err:
            raise Exception('Could not create DB: %s' % err)

        shutil.copytree("%s/ntp" % defaults_dir, "%s/ntp" % config_dir)
        shutil.copytree("%s/logs" % defaults_dir, "%s/logs" % config_dir)

        # Delete any existing NTP file
        r2 = client.cmd('roles:master', 'cmd.run_all', [
                        'rm /etc/ntp.conf'], expr_form='grain')

        # Link the new NTP conf file on the primary onto the admin vol
        ip_info, err = networking.get_ip_info('bond0')
        if err:
            raise Exception(err)
        ip_l = struct.unpack('!L', socket.inet_aton(ip_info['ipaddr']))[0]
        netmask_l = struct.unpack(
            '!L', socket.inet_aton(ip_info['netmask']))[0]
        network_l = ip_l & netmask_l
        network = socket.inet_ntoa(struct.pack('!L', network_l))
        r2 = client.cmd('roles:master', 'integralstor.configure_ntp_master', admin_gridcells, kwarg={
                        'network': network, 'netmask': ip_info['netmask']}, expr_form='grain')
        if r2:
            errors = ''
            for node, ret in r2.items():
                if not ret[0]:
                    print r2
                    errors += "Error configuring NTP on %s : %s" % (
                        node, ret[1])
            if errors:
                raise Exception(errors)

        # Create a home for the manifest and status files and move the
        # previously generated files here..
        os.mkdir("%s/status" % config_dir)
        shutil.move("%s/master.manifest" % tmp_path, ss_path)
        shutil.move("%s/master.status" % tmp_path, ss_path)

        print "Copying the default configuration onto the IntegralStor administration volume... Done."
        print

        print "Setting up CIFS access.."

        os.mkdir("%s/lock" % config_dir)
        os.mkdir("%s/samba" % config_dir)

        os.mkdir("%s/logs/task_logs" % config_dir, 0777)

        print "Creating assert_admin_vol_mount file"
        with open('%s/lock/assert_admin_vol_mount' % config_dir, 'w') as f:
            f.close()
        print "Creating assert_admin_vol_mount file... Done"
        print

        print "Creating CTDB config file"
        rc, errors = ctdb.create_config_file()
        if not rc:
            if errors:
                raise Exception(errors)
            else:
                raise Exception(
                    "Error creating the CTDB configuration file : Reason unknown")
        print "Creating CTDB config file... Done"
        print

        print "Creating CTDB nodes file"

        ip_list = []
        for node_name, node_info in si.items():
            if "interfaces" in node_info and "bond0" in node_info["interfaces"] and "inet" in node_info["interfaces"]["bond0"] and len(node_info["interfaces"]["bond0"]["inet"]) == 1:
                ip_list.append(
                    "%s" % node_info["interfaces"]["bond0"]["inet"][0]["address"])

        rc, errors = ctdb.add_to_nodes_file(ip_list)
        if not rc:
            if errors:
                raise Exception(errors)
            else:
                raise Exception(
                    "Error creating the CTDB nodes file : Reason unknown")
        print "Creating CTDB nodes file... Done"
        print

        # Create an empty public_addresses file. Entries to the file will be
        # added later from the menus.
        print "Creating CTDB public_addresses file(blank)"
        rc, err = ctdb.mod_public_addresses(None, action='create')
        if err:
            raise Exception(err)
        print "Creating CTDB public_addresses file(blank)... Done"

        print "Placing CTDB files"
        shutil.copyfile('/etc/sysconfig/ctdb', '%s/lock/ctdb' % config_dir)
        r2 = client.cmd('*', 'cmd.run_all', ['rm /etc/sysconfig/ctdb'])
        r2 = client.cmd('*', 'cmd.run_all',
                        ['cp %s/lock/ctdb /etc/sysconfig/ctdb' % config_dir])
        if r2:
            for node, ret in r2.items():
                if ret["retcode"] != 0:
                    print r2
                    errors = "Error placing the CTDB config file on %s" % node
                    raise Exception(errors)
        print "Placing CTDB files... Done"
        print

        # The initial add_to_nodes_file created the initial nodes file in admin
        # vol. So pull it to corresponding /etc/ctdb/ path on all nodes

        print "Placing CTDB nodes files"
        # next line is redundant?
        shutil.copyfile('%s/lock/nodes' % config_dir, '/etc/ctdb/nodes')
        r2 = client.cmd('*', 'cmd.run_all', ['rm -f /etc/ctdb/nodes'])
        r2 = client.cmd('*', 'cmd.run_all',
                        ['cp %s/lock/nodes /etc/ctdb/nodes' % config_dir])
        if r2:
            for node, ret in r2.items():
                if ret["retcode"] != 0:
                    print r2
                    errors = "Error linking to the CTDB nodes file on %s" % node
                    raise Exception(errors)
        print "Placing CTDB nodes files... Done"
        print

        print "Placing CTDB public_addresses files"
        # next line is redundant?
        shutil.copyfile('%s/lock/public_addresses' %
                        config_dir, '/etc/ctdb/public_addresses')
        r2 = client.cmd('*', 'cmd.run_all',
                        ['rm -f /etc/ctdb/public_addresses'])
        r2 = client.cmd(
            '*', 'cmd.run_all', ['cp %s/lock/public_addresses /etc/ctdb/public_addresses' % config_dir])
        if r2:
            for node, ret in r2.items():
                if ret["retcode"] != 0:
                    print r2
                    errors = "Error linking to the CTDB nodes file on %s" % node
                    raise Exception(errors)
        print "Placing CTDB public_addresses files... Done"
        print

        print "Linking smb.conf files"
        shutil.copyfile('%s/samba/smb.conf' % defaults_dir,
                        '%s/lock/smb.conf' % config_dir)
        r2 = client.cmd('*', 'cmd.run_all', ['rm -f /etc/samba/smb.conf'])
        r2 = client.cmd(
            '*', 'cmd.run_all', ['ln -s %s/lock/smb.conf /etc/samba/smb.conf' % config_dir])
        if r2:
            for node, ret in r2.items():
                if ret["retcode"] != 0:
                    print r2
                    errors = "Error linking to the smb.conf file on %s" % node
                    raise Exception(errors)
        print "Linking smb.conf files... Done"
        print

        print "Linking NFS exports file"
        shutil.copyfile('%s/nfs/exports' % defaults_dir,
                        '%s/lock/exports' % config_dir)
        r2 = client.cmd('*', 'cmd.run_all', ['rm -f /etc/exports'])
        r2 = client.cmd(
            '*', 'cmd.run_all', ['ln -s %s/lock/exports /etc/exports' % config_dir])
        if r2:
            for node, ret in r2.items():
                if ret["retcode"] != 0:
                    print r2
                    errors = "Error linking to the NFS exports file on %s" % node
                    raise Exception(errors)
        print "Linking NFS exports file... Done"
        print

        print "Linking Kerberos config file"
        r2 = client.cmd('*', 'cmd.run_all', ['rm /etc/krb5.conf'])
        with open('%s/lock/krb5.conf' % config_dir, 'w') as f:
            f.close()
        r2 = client.cmd('*', 'cmd.run_all',
                        ['ln -s %s/lock/krb5.conf /etc/krb5.conf' % config_dir])
        if r2:
            for node, ret in r2.items():
                if ret["retcode"] != 0:
                    print r2
                    errors = "Error linking to the krb5.conf file on %s" % node
                    raise Exception(errors)
        print "Linking Kerberos config file... Done"
        print

        print "Setting appropriate boot time init files."
        r2 = client.cmd('*', 'cmd.run_all', ['rm /etc/rc.local'])
        r2 = client.cmd('*', 'cmd.run_all', ['rm /etc/rc.d/rc.local'])
        r2 = client.cmd(
            '*', 'cmd.run_all', ['cp %s/rc_local/rc.local /etc/rc.local' % defaults_dir])
        r2 = client.cmd('*', 'cmd.run_all', ['chmod 755 /etc/rc.local'])
        if r2:
            for node, ret in r2.items():
                if ret["retcode"] != 0:
                    print r2
                    errors = "Error setting the appropriate rc.local file on %s" % node
                    raise Exception(errors)
        print "Setting appropriate boot time init files... Done"
        print

    except Exception, e:
        return False, 'Error establishing default configuration : %s' % str(e)