'Gathers facts for Daemonsets in logging namespace'

def facts_for_daemonsets(self, namespace):

    self.default_keys_for('daemonsets')
    ds_list = self.oc_command('get', 'daemonsets', namespace=namespace, add_options=['-l', (LOGGING_INFRA_KEY + '=fluentd')])
    if (len(ds_list['items']) == 0):
        return
    for ds_item in ds_list['items']:
        name = ds_item['metadata']['name']
        comp = self.comp(name)
        spec = ds_item['spec']['template']['spec']
        container = spec['containers'][0]
        result = dict(selector=ds_item['spec']['selector'], image=container['image'], resources=container['resources'], nodeSelector=spec['nodeSelector'], serviceAccount=spec['serviceAccount'], terminationGracePeriodSeconds=spec['terminationGracePeriodSeconds'])
        self.add_facts_for(comp, 'daemonsets', name, result)
