Пример #1
0
    def initDatabase(self) -> Tuple[Any, Session]:
        msg = _('Initializing database')

        self._logger.info(msg)

        print_('\n' + msg + '... ', end='')

        # This cannot be a global import since the database configuration
        # may be set in this script.
        from tortuga.db.dbManager import DbManager

        dbm = DbManager()

        # create database
        dbm.init_database()

        session = dbm.openSession()

        # Prime the database previously created as part of the bootstrap
        try:
            dbUtility.primeDb(session, self._settings)

            dbUtility.init_global_parameters(session, self._settings)

            print_(_('done'))

            session.commit()
        except Exception as exc:  # pylint: disable=broad-except
            session.rollback()

            print_(_('failed.'))

            print_(_('Exception raised initializing database:') +
                   ' {0}'.format(exc),
                   file=sys.stderr)

        self._logger.debug('Done initializing database')

        return dbm, session
Пример #2
0
    def initDatabase(self):
        msg = _('Initializing database')

        self._logger.info(msg)

        print_('\n' + msg + '... ', end='')

        # This cannot be a global import since the database configuration
        # may be set in this script.
        from tortuga.db.dbManager import DbManager

        dbm = DbManager()

        dbm.init_database()

        # Prime the database previously created as part of the bootstrap
        with dbm.session() as session:
            try:
                dbUtility.primeDb(session, self._settings['fqdn'],
                                  self._osInfo, self._settings)

                dbUtility.init_global_parameters(session, self._settings)

                print_(_('done'))

                session.commit()
            except Exception as exc:
                session.rollback()

                print_(_('failed.'))

                print_(_('Exception raised initializing database:') +
                       ' {0}'.format(exc),
                       file=sys.stderr)

        self._logger.debug('Done initializing database')
Пример #3
0
def dbm():
    dbmgr = DbManager(create_engine('sqlite:///:memory:', echo=False))

    dbmgr.init_database()

    rhel7_os_family_info = osFamilyInfo.OsFamilyInfo('rhel', '7', 'x86_64')

    os_info = osInfo.OsInfo('centos', '7.4', 'x86_64')
    os_info.setOsFamilyInfo(rhel7_os_family_info)

    installer_fqdn = getfqdn()

    settings = {
        'language': 'en',
        'keyboard': 'en_US',
        'timezone': 'UTC',
        'utc': 'true',
        'intWebPort': '8008',
        'intWebServicePort': '8444',
        'adminPort': '8443',
        'eulaAccepted': 'true',
        'depotpath': '/opt/tortuga/depot',
        'osInfo': os_info,
        'fqdn': installer_fqdn,
        'installer_software_profile': 'Installer',
        'installer_hardware_profile': 'Installer',
    }

    with dbmgr.session() as session:
        primeDb(session, settings)

        init_global_parameters(session, settings)

        # create sample tags
        all_tags = [{
            'name': 'tag{:d}'.format(idx),
            'value': 'value{:d}'.format(idx)
        } for idx in range(1, 5 + 1)]

        installer_node = session.query(Node).filter(
            Node.name == installer_fqdn).one()

        os_ = session.query(OperatingSystem).filter(
            OperatingSystem.name == 'centos').one()

        rhel7_os_family = session.query(OperatingSystemFamily).filter(
            OperatingSystemFamily.name == 'rhel').one()

        # add add'l operating system/family
        rhel75_os = OperatingSystem(name='rhel', version='7.5', arch='x86_64')
        rhel75_os.family = rhel7_os_family

        session.add(rhel75_os)

        admin = Admin(username='******',
                      password=pbkdf2_sha256.hash('password'),
                      realname='realname',
                      description='description')

        session.add(admin)

        eth1_network_device = NetworkDevice(name='eth1')

        # Add dummy provisioning network
        network = Network()
        network.address = '10.2.0.0'
        network.netmask = '255.255.255.0'
        network.name = 'Provisioning network on eth1'
        network.type = 'provision'

        session.add(network)

        # create 'hardwareprofilenetwork' entry
        hwpn1 = HardwareProfileNetwork(
            hardwareprofile=installer_node.hardwareprofile,
            network=network,
            networkdevice=eth1_network_device)

        # create nic on installer
        installer_nic = Nic()
        installer_nic.ip = '10.2.0.1'
        installer_nic.network = network
        installer_nic.networkdevice = eth1_network_device

        installer_node.nics = [installer_nic]

        # create 'base' kit
        kit = Kit()
        kit.name = 'base'
        kit.version = '7.1.1'
        kit.iteration = '0'
        kit.description = 'Sample base kit'

        installer_component = Component(name='installer', version='7.0')
        installer_component.family = [rhel7_os_family]
        installer_component.kit = kit

        core_component = Component(name='core',
                                   version='7.0',
                                   description='Compute component')
        core_component.family = [rhel7_os_family]
        core_component.kit = kit

        session.add(kit)

        # create OS kit
        os_kit = Kit(name='centos', version='7.4', iteration='0')
        os_kit.isOs = True
        os_component = Component(name='centos-7.4-x86_64', version='7.4')
        os_component.os = [os_]
        os_component.kit = os_kit
        os_kit.components.append(os_component)

        session.add(os_kit)

        # create resource adapter kit
        ra_kit = Kit(name='awsadapter', version='0.0.1', iteration='0')
        ra_component = Component(name='management', version='0.0.1')
        ra_component.family.append(rhel7_os_family)
        ra_kit.components.append(ra_component)

        installer_node.softwareprofile.components.append(ra_component)
        installer_node.softwareprofile.components.append(installer_component)
        session.commit()

        # create 'default' resource adapter
        default_adapter = ResourceAdapter(
            name=DEFAULT_CONFIGURATION_PROFILE_NAME,
            kit=kit,
        )

        # create resource adapter
        aws_adapter = ResourceAdapter(name='AWS')
        aws_adapter.kit = ra_kit

        aws_adapter_cfg = ResourceAdapterConfig(
            name=DEFAULT_CONFIGURATION_PROFILE_NAME,
            description='Example default resource adapter configuration')

        with mock_ec2_deprecated():
            ec2_conn = boto.ec2.connect_to_region('us-east-1')

            amis = ec2_conn.get_all_images()

            aws_adapter_cfg.configuration.append(
                ResourceAdapterSetting(key='ami', value=amis[0].id))

        aws_adapter.resource_adapter_config.append(aws_adapter_cfg)

        # add second resource adapter configuration
        aws_adapter_cfg2 = ResourceAdapterConfig(name='nondefault',
                                                 admin=admin)
        aws_adapter_cfg2.configuration.append(
            ResourceAdapterSetting(key='another_key', value='another_value'))

        session.add(aws_adapter)

        # create 'AWS' hardware profile
        aws_hwprofile = HardwareProfile(name='AWS')
        aws_hwprofile.location = 'remote'
        aws_hwprofile.resourceadapter = aws_adapter

        session.add(aws_hwprofile)

        aws_hwprofile2 = HardwareProfile(name='aws2',
                                         location='remote',
                                         resourceadapter=aws_adapter,
                                         nameFormat='*')

        session.add(aws_hwprofile2)

        # create 'compute' software profile
        compute_swprofile = SoftwareProfile(name='compute')
        compute_swprofile.os = os_
        compute_swprofile.components = [core_component]
        compute_swprofile.type = 'compute'

        # create 'compute2' software profile
        compute2_swprofile = SoftwareProfile(name='compute2',
                                             os=os_,
                                             components=[core_component],
                                             type='compute')

        # map 'AWS' to 'compute'
        aws_hwprofile.mappedsoftwareprofiles.append(compute_swprofile)
        aws_hwprofile2.mappedsoftwareprofiles.append(compute_swprofile)

        # create 'localiron' hardware profile
        localiron_hwprofile = HardwareProfile(name='localiron',
                                              nameFormat='compute-#NN')
        localiron_hwprofile.resourceadapter = default_adapter
        localiron_hwprofile.mappedsoftwareprofiles.append(compute_swprofile)
        localiron_hwprofile.mappedsoftwareprofiles.append(compute2_swprofile)

        localiron_hwprofile.hardwareprofilenetworks.append(hwpn1)

        # create 'nonetwork' hardware profile
        nonetwork_hwprofile = HardwareProfile(name='nonetwork')
        nonetwork_hwprofile.resourceadapter = default_adapter
        nonetwork_hwprofile.mappedsoftwareprofiles.append(compute_swprofile)

        eth0_networkdevice = NetworkDevice(name='eth0')

        # create compute (compute-01, compute-02, ...) nodes
        for n in range(1, 11):
            compute_node = Node(name='compute-{0:02d}.private'.format(n),
                                state='Installed')
            compute_node.addHostSession = '1234'
            compute_node.softwareprofile = compute_swprofile
            compute_node.hardwareprofile = localiron_hwprofile

            compute_node.nics.append(
                Nic(ip='10.2.0.{}'.format(100 + n),
                    mac='FF:00:00:00:00:00:{:02x}'.format(100 + n),
                    boot=True,
                    network=network,
                    networkdevice=eth0_networkdevice))

            if n in (1, 2):
                # compute-01 and compute-02 have all tags
                compute_node.tags = [
                    NodeTag(
                        name=tag['name'],
                        value=tag['value'],
                    ) for tag in all_tags
                ]
            elif n in (3, 4):
                # compute-03 and compute-04 have 'tag1' and 'tag2'
                compute_node.tags = [
                    NodeTag(
                        name=all_tags[0]['name'],
                        value=all_tags[0]['value'],
                    ),
                    NodeTag(
                        name=all_tags[1]['name'],
                        value=all_tags[1]['value'],
                    ),
                ]
            elif n in (5, 6):
                # compute-05 and compute-06 have 'tag2' and 'tag3'
                compute_node.tags = [
                    NodeTag(
                        name=all_tags[1]['name'],
                        value=all_tags[1]['value'],
                    ),
                    NodeTag(
                        name=all_tags[2]['name'],
                        value=all_tags[2]['value'],
                    ),
                ]
            elif n == 7:
                # compute-07 has 'tag4'
                compute_node.tags = [
                    NodeTag(
                        name=all_tags[3]['name'],
                        value=all_tags[3]['value'],
                    ),
                ]
            elif n == 8:
                # compute-08 has 'tag5'
                compute_node.tags = [
                    NodeTag(
                        name=all_tags[4]['name'],
                        value=all_tags[4]['value'],
                    ),
                ]

            session.add(compute_node)

        # create arbitrary aws nodes
        for idx in range(1, 10):
            new_node = Node(
                name='ip-10-10-10-{:0d}.ec2.internal'.format(idx),
                hardwareprofile=aws_hwprofile,
                softwareprofile=compute_swprofile,
            )

            new_node.instance = InstanceMapping(
                instance='i-{:08x}'.format(idx))

            new_node.instance.resource_adapter_configuration = aws_adapter_cfg

            session.add(new_node)

        # create arbitrary hardware profiles
        hwprofile1 = HardwareProfile(
            name='profile1',
            tags=[
                HardwareProfileTag(
                    name=all_tags[0]['name'],
                    value=all_tags[0]['value'],
                ),
            ],
        )
        hwprofile2 = HardwareProfile(
            name='profile2',
            tags=[
                HardwareProfileTag(
                    name=all_tags[1]['name'],
                    value=all_tags[1]['value'],
                ),
            ],
        )

        session.add(hwprofile1)
        session.add(hwprofile2)

        # create arbitrary software profiles
        SoftwareProfile(
            name='swprofile1',
            os=os_,
            type='compute',
            tags=[
                SoftwareProfileTag(name=all_tags[0]['name'],
                                   value=all_tags[0]['value']),
            ],
        )

        SoftwareProfile(
            name='swprofile2',
            os=os_,
            type='compute',
            tags=[
                SoftwareProfileTag(
                    name=all_tags[1]['name'],
                    value=all_tags[1]['value'],
                ),
            ],
        )

        session.commit()

    return dbmgr
Пример #4
0
def dbm():
    dbmgr = DbManager(create_engine('sqlite:///:memory:', echo=False))

    dbmgr.init_database()

    rhel7_os_family_info = osFamilyInfo.OsFamilyInfo('rhel', '7', 'x86_64')

    os_info = osInfo.OsInfo('centos', '7.4', 'x86_64')
    os_info.setOsFamilyInfo(rhel7_os_family_info)

    settings = {
        'language': 'en',
        'keyboard': 'en_US',
        'timezone': 'UTC',
        'utc': 'true',
        'intWebPort': '8008',
        'intWebServicePort': '8444',
        'adminPort': '8443',
        'eulaAccepted': 'true',
        'depotpath': '/opt/tortuga/depot',
        'osInfo': os_info,
        'fqdn': getfqdn(),
        'installer_software_profile': 'Installer',
        'installer_hardware_profile': 'Installer',
    }

    with dbmgr.session() as session:
        primeDb(session, settings)

        init_global_parameters(session, settings)

        # create sample tags
        all_tags = []
        for idx in range(1, 5 + 1):
            tag = dict(
                name='tag{:d}'.format(idx),
                value='value{:d}'.format(idx),
            )
            all_tags.append(tag)

        installer_node = session.query(Node).filter(
            Node.name == settings['fqdn']).one()

        os_ = session.query(OperatingSystem).filter(
            OperatingSystem.name == 'centos').one()

        rhel7_os_family = session.query(OperatingSystemFamily).filter(
            OperatingSystemFamily.name == 'rhel').one()

        # add add'l operating system/family
        rhel75_os = OperatingSystem(name='rhel', version='7.5', arch='x86_64')
        rhel75_os.family = rhel7_os_family

        session.add(rhel75_os)

        admin = Admin(username='******',
                      password=pbkdf2_sha256.hash('password'),
                      realname='realname',
                      description='description')

        session.add(admin)

        eth0_network_device = NetworkDevice(name='eth0')

        eth1_network_device = NetworkDevice(name='eth1')

        # Add dummy provisioning network
        network = Network(address='10.2.0.0',
                          netmask='255.255.255.0',
                          name='Provisioning network on eth1',
                          type='provision')

        installer_node.hardwareprofile.hardwareprofilenetworks.append(
            HardwareProfileNetwork(
                network=network,
                networkdevice=eth1_network_device,
            ))

        # create nic on installer
        installer_nic = Nic(
            ip='10.2.0.1',
            network=network,
            networkdevice=eth1_network_device,
        )

        installer_node.nics = [installer_nic]

        # create 'base' kit
        kit = Kit()
        kit.name = 'base'
        kit.version = '7.1.0'
        kit.iteration = '0'
        kit.description = 'Sample base kit'

        installer_component = Component(name='installer', version='7.0')
        installer_component.family = [rhel7_os_family]
        installer_component.kit = kit

        core_component = Component(name='core',
                                   version='7.0',
                                   description='Compute component')
        core_component.family = [rhel7_os_family]
        core_component.kit = kit

        # add component not enabled by default
        pdsh_component = Component(name='pdsh',
                                   version='7.0',
                                   description='pdsh component')
        pdsh_component.family = [rhel7_os_family]
        pdsh_component.kit = kit

        # add fake dhcp component
        dhcpd_component = Component(name='dhcpd',
                                    version='7.0',
                                    description='Mock dhcpd component')
        dhcpd_component.family = [rhel7_os_family]
        dhcpd_component.kit = kit

        session.add(kit)

        # create OS kit
        os_kit = Kit(name='centos', version='7.4', iteration='0')
        os_kit.isOs = True
        os_component = Component(name='centos-7.4-x86_64', version='7.4')
        os_component.os = [os_]
        os_component.kit = os_kit
        os_kit.components.append(os_component)

        session.add(os_kit)

        # create resource adapter kit
        ra_kit = Kit(name='awsadapter', version='0.0.1', iteration='0')
        ra_component = Component(name='management', version='0.0.1')
        ra_component.family.append(rhel7_os_family)
        ra_kit.components.append(ra_component)

        installer_node.softwareprofile.components.append(ra_component)
        installer_node.softwareprofile.components.append(installer_component)
        installer_node.softwareprofile.components.append(dhcpd_component)

        # create 'default' resource adapter
        default_adapter = ResourceAdapter(name='default', kit=kit)

        # create resource adapter
        aws_adapter = ResourceAdapter(name='aws', kit=ra_kit)

        aws_adapter_cfg = ResourceAdapterConfig(
            name='default',
            description='Example default resource adapter configuration')

        aws_adapter_cfg.configuration.append(
            ResourceAdapterSetting(key='ami', value='ami-XXXXXX'))

        aws_adapter_cfg.configuration.append(
            ResourceAdapterSetting(key='use_instance_hostname', value='true'))

        aws_adapter.resource_adapter_config.append(aws_adapter_cfg)

        # add second resource adapter configuration
        aws_adapter_cfg2 = ResourceAdapterConfig(name='nondefault',
                                                 admin=admin)
        aws_adapter_cfg2.configuration.append(
            ResourceAdapterSetting(key='another_key', value='another_value'))

        aws_adapter.resource_adapter_config.append(aws_adapter_cfg2)

        session.add(aws_adapter)

        # create 'aws' hardware profile
        # does *not* have a default resource adapter config
        aws_hwprofile = HardwareProfile(name='aws')
        aws_hwprofile.location = 'remote'
        aws_hwprofile.resourceadapter = aws_adapter
        aws_hwprofile.nameFormat = '*'

        session.add(aws_hwprofile)

        # add hardware profile 'aws2' with non-default configuration profile
        aws_hwprofile2 = HardwareProfile(
            name='aws2',
            location='remote',
            resourceadapter=aws_adapter,
            default_resource_adapter_config=aws_adapter_cfg2,
            nameFormat='*',
        )

        session.add(aws_hwprofile2)

        # create 'compute' software profile
        compute_swprofile = SoftwareProfile(name='compute')
        compute_swprofile.os = os_
        compute_swprofile.components = [core_component]
        compute_swprofile.type = 'compute'

        # create 'compute2' software profile
        compute2_swprofile = SoftwareProfile(name='compute2',
                                             os=os_,
                                             components=[core_component],
                                             type='compute')

        # map 'aws' and 'aws2' to 'compute'
        compute_swprofile.hardwareprofiles.extend(
            (aws_hwprofile, aws_hwprofile2))

        # create 'localiron' hardware profile
        localiron_hwprofile = HardwareProfile(
            name='localiron',
            nameFormat='compute-#NN',
            location='local',
        )
        localiron_hwprofile.resourceadapter = default_adapter
        localiron_hwprofile.mappedsoftwareprofiles = [
            compute_swprofile, compute2_swprofile
        ]

        localiron_hwprofile.hardwareprofilenetworks.append(
            HardwareProfileNetwork(
                network=network,
                networkdevice=eth0_network_device,
            ))

        session.add(localiron_hwprofile)

        # create "localironalt" hardware profile with nameFormat set to '*'
        localironalt_hwprofile = HardwareProfile(
            name='localironalt',
            nameFormat='*',
            location='local',
        )
        localironalt_hwprofile.resourceadapter = default_adapter
        localironalt_hwprofile.mappedsoftwareprofiles = [
            compute_swprofile, compute2_swprofile
        ]

        localironalt_hwprofile.hardwareprofilenetworks.append(
            HardwareProfileNetwork(
                network=network,
                networkdevice=eth0_network_device,
            ))

        # create 'nonetwork' hardware profile
        nonetwork_hwprofile = HardwareProfile(name='nonetwork')
        nonetwork_hwprofile.resourceadapter = default_adapter
        nonetwork_hwprofile.mappedsoftwareprofiles.append(compute_swprofile)

        # create compute (compute-01, compute-02, ...) nodes
        for n in range(1, 11):
            compute_node = Node(name='compute-{0:02d}.private'.format(n),
                                state='Installed')
            compute_node.addHostSession = '1234'
            compute_node.softwareprofile = compute_swprofile
            compute_node.hardwareprofile = localiron_hwprofile

            compute_node.nics.append(
                Nic(ip='10.2.0.{}'.format(100 + n),
                    mac='FF:00:00:00:00:00:{:02x}'.format(100 + n),
                    boot=True,
                    network=network,
                    networkdevice=eth0_network_device))

            if n in (1, 2):
                # compute-01 and compute-02 have all tags
                for tag in all_tags:
                    compute_node.tags.append(
                        NodeTag(name=tag['name'], value=tag['value']))
            elif n in (3, 4):
                # compute-03 and compute-04 have 'tag1' and 'tag2'
                compute_node.tags.append(
                    NodeTag(name=all_tags[0]['name'],
                            value=all_tags[0]['value']))
                compute_node.tags.append(
                    NodeTag(name=all_tags[1]['name'],
                            value=all_tags[1]['value']))
            elif n in (5, 6):
                # compute-05 and compute-06 have 'tag2' and 'tag3'
                compute_node.tags.append(
                    NodeTag(name=all_tags[1]['name'],
                            value=all_tags[1]['value']))
                compute_node.tags.append(
                    NodeTag(name=all_tags[2]['name'],
                            value=all_tags[2]['value']))
            elif n == 7:
                # compute-07 has 'tag4'
                compute_node.tags.append(
                    NodeTag(name=all_tags[3]['name'],
                            value=all_tags[3]['value']))
            elif n == 8:
                # compute-08 has 'tag5'
                compute_node.tags.append(
                    NodeTag(name=all_tags[4]['name'],
                            value=all_tags[4]['value']))

            session.add(compute_node)

        # create arbitrary hardware profiles
        hwprofile1 = HardwareProfile(name='profile1',
                                     nameFormat='*',
                                     tags=[
                                         HardwareProfileTag(
                                             name=all_tags[0]['name'],
                                             value=all_tags[0]['value'])
                                     ])
        hwprofile2 = HardwareProfile(name='profile2',
                                     nameFormat='*',
                                     tags=[
                                         HardwareProfileTag(
                                             name=all_tags[1]['name'],
                                             value=all_tags[1]['value'])
                                     ])
        hwprofile_notags = HardwareProfile(name='notags', nameFormat='*')

        session.add(hwprofile1)
        session.add(hwprofile2)
        session.add(hwprofile_notags)

        # create arbitrary software profiles
        swprofile1 = SoftwareProfile(name='swprofile1',
                                     os=os_,
                                     type='compute',
                                     tags=[
                                         SoftwareProfileTag(
                                             name=all_tags[0]['name'],
                                             value=all_tags[0]['value'])
                                     ])
        swprofile2 = SoftwareProfile(name='swprofile2',
                                     os=os_,
                                     type='compute',
                                     tags=[
                                         SoftwareProfileTag(
                                             name=all_tags[1]['name'],
                                             value=all_tags[1]['value'])
                                     ])
        swprofile_notags = SoftwareProfile(name='notags',
                                           os=os_,
                                           type='compute')

        session.add(swprofile1)
        session.add(swprofile2)
        session.add(swprofile_notags)

        session.commit()

    return dbmgr
Пример #5
0
    def _run_installer(self, db_manager: DbManager, installer):
        """
        Runs the installation process for a kit installer.

        :param db_manager: the DbManager instance
        :param installer: the KitInstaller instance to run the install process
                          for

        """
        kit = installer.get_kit()

        #
        # This method will throw KitAlreadyExists, if it does...
        #
        self._check_if_kit_exists(installer.session, kit)

        #
        # Validate eula
        #
        eula = installer.get_eula()
        if not eula:
            self._logger.debug('No EULA acceptance required')
        else:
            if not self._eula_validator.validate_eula(eula):
                raise EulaAcceptanceRequired(
                    'You must accept the EULA to install this kit')

        #
        # Runs the kit pre install method
        #
        installer.run_action('pre_install')

        #
        # Get list of operating systems supported by this installer
        #
        os_info_list = [
            repo.getOsInfo() for repo in repoManager.getRepoList()
        ]

        #
        # Install operating system specific packages
        #
        self._install_os_packages(kit, os_info_list)

        #
        # Initialize any DB tables provided by the kit
        #
        db_manager.init_database()

        #
        # Add the kit to the database
        #
        self._kit_db_api.addKit(installer.session, kit)

        #
        # Clean up the kit archive directory
        #
        self._clean_kit_achiv_dir(kit, installer.install_path)

        #
        # Install puppet modules
        #
        installer.run_action('install_puppet_modules')

        #
        # Run post install
        #
        installer.run_action('post_install')

        if eula:
            ActionManager().logAction(
                'Kit [{}] installed and EULA accepted at [{}]'
                ' local machine time.'.format(
                    installer.spec, time.ctime())
            )
        else:
            ActionManager().logAction(
                'Kit [{}] installed at [{}] local machine time.'.format(
                    installer.spec, time.ctime())
            )
Пример #6
0
    def installKitPackage(self, kit_pkg_url, key=None):
        """
        Install kit from the given kit url (url might be a local file). Kit
        will be installed for all operating systems that:

            1) have repo configured on the local machine
            2) are specified in the kit.xml file

        :raisesKitAlreadyExists:
        :raisesEulaAcceptanceRequired:

        """
        self.getLogger().debug('Installing kit package:'.format(kit_pkg_url))

        #
        # Download/copy and unpack kit archive.
        #
        kit_src_path = os.path.basename(kit_pkg_url)
        kit_pkg_path = utils.retrieve(kit_src_path, kit_pkg_url,
                                      self._kits_root)
        kit_spec = utils.unpack_archive(kit_pkg_path, self._kits_root)

        #
        # Load and initialize kit installer
        #
        load_kits()
        installer = get_kit_installer(kit_spec)()

        if not installer.is_installable():
            self.getLogger().warning(
                'Kit is not installable: {}'.format(kit_spec))
            return

        kit = installer.get_kit()

        #
        # This method will throw KitAlreadyExists, if it does...
        #
        self._check_if_kit_exists(kit)

        #
        # Validate eula
        #
        eula = installer.get_eula()
        if not self._eula_validator.validate_eula(eula):
            raise EulaAcceptanceRequired(
                'You must accept the EULA to install this kit')

        #
        # Runs the kit pre install method
        #
        installer.run_action('pre_install')

        #
        # Get list of operating systems supported by this installer
        #
        os_info_list = [repo.getOsInfo() for repo in repoManager.getRepoList()]

        #
        # Install operating system specific packages
        #
        self._install_os_packages(kit, os_info_list)

        #
        # Initialize andy DB tables provided by the kit
        #
        db_manager = DbManager()
        db_manager.init_database()

        #
        # Add the kit to the database
        #
        self._kit_db_api.addKit(kit)

        #
        # Clean up the kit archive directory
        #
        self._clean_kit_achiv_dir(kit, installer.install_path)

        #
        # Install puppet modules
        #
        installer.run_action('install_puppet_modules')

        #
        # Run post install
        #
        installer.run_action('post_install')

        if eula:
            ActionManager().logAction(
                'Kit [{}] installed and EULA accepted at [{}]'
                ' local machine time.'.format(installer.spec, time.ctime()))
        else:
            ActionManager().logAction(
                'Kit [{}] installed at [{}] local machine time.'.format(
                    installer.spec, time.ctime()))

        return kit