Ejemplo n.º 1
0
 def install(self, id):
     """
     Install 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 install options.
     @param id: A consumer ID.
     @type id: str
     @return: TBD
     @rtype: dict
     """
     body = self.params()
     units = body.get('units')
     options = body.get('options')
     call_request = consumer_content_install_itinerary(id, units, options)[0]
     result = execution.execute_async(self, call_request)
     return result
Ejemplo n.º 2
0
 def install(self, id):
     """
     Install 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 install options.
     @param id: A consumer ID.
     @type id: str
     @return: TBD
     @rtype: dict
     """
     body = self.params()
     units = body.get('units')
     options = body.get('options')
     call_request = consumer_content_install_itinerary(id, units, options)[0]
     result = execution.execute_async(self, call_request)
     return result
Ejemplo n.º 3
0
def consumer_group_content_install_itinerary(consumer_group_id, units, options):
    """
    Create an itinerary for consumer group content installation.
    :param consumer_group_id: unique id of the consumer group
    :type consumer_group_id: str
    :param units: units to install
    :type units: list or tuple
    :param options: options to pass to the install manager
    :type options: dict or None
    :return: list of call requests
    :rtype: list
    """
    consumer_group = managers.consumer_group_query_manager().get_group(consumer_group_id)
    consumer_group_call_requests_list = []
    for consumer_id in consumer_group['consumer_ids']:
        consumer_call_requests = consumer_content_install_itinerary(consumer_id, units, options)
        consumer_group_call_requests_list.extend(consumer_call_requests)
 
    return consumer_group_call_requests_list
Ejemplo n.º 4
0
def consumer_group_content_install_itinerary(consumer_group_id, units,
                                             options):
    """
    Create an itinerary for consumer group content installation.
    :param consumer_group_id: unique id of the consumer group
    :type consumer_group_id: str
    :param units: units to install
    :type units: list or tuple
    :param options: options to pass to the install manager
    :type options: dict or None
    :return: list of call requests
    :rtype: list
    """
    consumer_group = managers.consumer_group_query_manager().get_group(
        consumer_group_id)
    consumer_group_call_requests_list = []
    for consumer_id in consumer_group['consumer_ids']:
        consumer_call_requests = consumer_content_install_itinerary(
            consumer_id, units, options)
        consumer_group_call_requests_list.extend(consumer_call_requests)

    return consumer_group_call_requests_list