コード例 #1
0
    def _check_if_updated(self):
        logger.info("Checking if agent updated.")
        update_result = {}

        try:

            if os.path.exists(settings.update_file):
                with open(settings.update_file, 'r') as _file:
                    update_result = json.load(_file)

                app_id = update_result['app_id']
                operation_id = update_result['operation_id']
                success = update_result['success']
                error = update_result.get('error', '')

                rvsof_result = RvSofResult(
                    operation_id,
                    RvOperationValue.InstallAgentUpdate,
                    app_id,  # app id
                    [],  # apps_to_delete
                    [],  # apps_to_add
                    success,  # success
                    'false',  # restart
                    error,  # error
                    "{}",  # app json
                    RvUrn.get_install_agent_update_urn(),
                    RequestMethod.PUT
                )

                logger.info(rvsof_result.__dict__)

                self._send_results(rvsof_result)

                os.remove(settings.update_file)

        except Exception as e:
            logger.error("Failure while sending agent update result.")
            logger.exception(e)
コード例 #2
0
    def _check_if_updated(self):
        logger.info("Checking if agent updated.")
        update_result = {}

        try:

            if os.path.exists(settings.update_file):
                with open(settings.update_file, 'r') as _file:
                    update_result = json.load(_file)

                app_id = update_result['app_id']
                operation_id = update_result['operation_id']
                success = update_result['success']
                error = update_result.get('error', '')

                rvsof_result = RvSofResult(
                    operation_id,
                    RvOperationValue.InstallAgentUpdate,
                    app_id,  # app id
                    [],  # apps_to_delete
                    [],  # apps_to_add
                    success,  # success
                    'false',  # restart
                    error,  # error
                    "{}",  # app json
                    RvUrn.get_install_agent_update_urn(),
                    RequestMethod.PUT)

                logger.info(rvsof_result.__dict__)

                self._send_results(rvsof_result)

                os.remove(settings.update_file)

        except Exception as e:
            logger.error("Failure while sending agent update result.")
            logger.exception(e)