Example #1
0
 def uninstall(self, consumer_id):
     """
     Uninstall content (units) on a consumer.
     Expected body: {units:[], options:<dict>}
     where unit is: {type_id:<str>, unit_key={}} and the
     options is a dict of uninstall options.
     @param consumer_id: A consumer ID.
     @type consumer_id: str
     """
     body = self.params()
     units = body.get('units')
     options = body.get('options')
     agent_manager = managers.consumer_agent_manager()
     task = agent_manager.uninstall_content(consumer_id, units, options)
     raise OperationPostponed(TaskResult.from_task_status_dict(task))
Example #2
0
 def uninstall(self, consumer_id):
     """
     Uninstall content (units) on a consumer.
     Expected body: {units:[], options:<dict>}
     where unit is: {type_id:<str>, unit_key={}} and the
     options is a dict of uninstall options.
     @param consumer_id: A consumer ID.
     @type consumer_id: str
     """
     body = self.params()
     units = body.get('units')
     options = body.get('options')
     agent_manager = managers.consumer_agent_manager()
     task = agent_manager.uninstall_content(consumer_id, units, options)
     raise OperationPostponed(TaskResult.from_task_status_dict(task))
Example #3
0
    def uninstall(self, request, consumer_id, units, options):
        """
        Uninstall content (units) on a consumer.

        Expected body: {units:[], options:<dict>}
        where unit is: {type_id:<str>, unit_key={}} and the
        options is a dict of uninstall options.

        :param request: WSGI request object
        :type request: django.core.handlers.wsgi.WSGIRequest
        :param consumer_id: A consumer ID.
        :type consumer_id: str
        :param units: units to install
        :type units: list
        :param options: install options
        :type options: dict

        :raises OperationPostponed: when an async operation is performed.
        """

        agent_manager = factory.consumer_agent_manager()
        task = agent_manager.uninstall_content(consumer_id, units, options)
        raise OperationPostponed(TaskResult.from_task_status_dict(task))
Example #4
0
    def uninstall(self, request, consumer_id, units, options):
        """
        Uninstall content (units) on a consumer.

        Expected body: {units:[], options:<dict>}
        where unit is: {type_id:<str>, unit_key={}} and the
        options is a dict of uninstall options.

        :param request: WSGI request object
        :type request: django.core.handlers.wsgi.WSGIRequest
        :param consumer_id: A consumer ID.
        :type consumer_id: str
        :param units: units to install
        :type units: list
        :param options: install options
        :type options: dict

        :raises OperationPostponed: when an async operation is performed.
        """

        agent_manager = factory.consumer_agent_manager()
        task = agent_manager.uninstall_content(consumer_id, units, options)
        raise OperationPostponed(TaskResult.from_task_status_dict(task))
Example #5
0
    def update(self, consumer_id):
        """
        Update content (units) on a consumer.
        Expected body: {units:[], options:<dict>}
        where unit is: {type_id:<str>, unit_key={}} and the
        options is a dict of update options.
        @param consumer_id: A consumer ID.
        @type consumer_id: str
        """
        body = self.params()
        missing_params = []
        units = body.get('units')
        if units is None:
            missing_params.append('units')
        options = body.get('options')
        if options is None:
            missing_params.append('options')

        if len(missing_params) > 0:
            raise MissingValue(missing_params)

        agent_manager = managers.consumer_agent_manager()
        task = agent_manager.update_content(consumer_id, units, options)
        raise OperationPostponed(TaskResult.from_task_status_dict(task))