Exemplo n.º 1
0
    def start(self, env, upgrade_type=None):
        import params
        env.set_params(params)
        install_knox()
        self.configure(env)
        daemon_cmd = format('{knox_bin} start')
        no_op_test = format(
            'ls {knox_pid_file} >/dev/null 2>&1 && ps -p `cat {knox_pid_file}` >/dev/null 2>&1'
        )
        setup_ranger_knox(upgrade_type=upgrade_type)
        # Used to setup symlink, needed to update the knox managed symlink, in case of custom locations
        if os.path.islink(params.knox_managed_pid_symlink):
            Link(
                params.knox_managed_pid_symlink,
                to=params.knox_pid_dir,
            )

        update_knox_logfolder_permissions()

        try:
            Execute(daemon_cmd,
                    user=params.knox_user,
                    environment={'JAVA_HOME': params.java_home},
                    not_if=no_op_test)
        except:
            show_logs(params.knox_logs_dir, params.knox_user)
            raise
Exemplo n.º 2
0
    def install(self, env):
        import params
        env.set_params(params)
        install_knox()

        File(
            os.path.join(params.knox_conf_dir, 'topologies', 'sandbox.xml'),
            action="delete",
        )
Exemplo n.º 3
0
    def pre_upgrade_restart(self, env, upgrade_type=None):
        import params
        env.set_params(params)

        # backup the data directory to /tmp/knox-upgrade-backup/knox-data-backup.tar just in case
        # something happens; Knox is interesting in that they re-generate missing files like
        # keystores which can cause side effects if the upgrade goes wrong
        if params.upgrade_direction and params.upgrade_direction == Direction.UPGRADE:
            absolute_backup_dir = upgrade.backup_data()
            Logger.info("Knox data was successfully backed up to {0}".format(
                absolute_backup_dir))

        install_knox()
        # seed the new Knox data directory with the keystores of yesteryear
        if params.upgrade_direction == Direction.UPGRADE:
            upgrade.seed_current_data_directory()