def from_dict_to_resource_node(projects):
    """ Creates a ResourceNode object from a project dict """

    node_projects = {}
    for key, node in projects.items():
        node_projects[key] = PolicyCheckResourceNode.from_dict(node)

    return node_projects
def from_dict_to_resource_node(projects):
    """ Creates a ResourceNode object from a project dict """

    node_projects = {}
    for key, node in projects.items():
        node_projects[key] = PolicyCheckResourceNode.from_dict(node)

    return node_projects
def create_policy_dict(projects):
    """ Creates a dict of policies and the rejected libs by them"""

    policy_dict = defaultdict(list)

    # project iterator
    for project, resource_node in projects.iteritems():
        rejected_node = PolicyCheckResourceNode.find_rejected_node(resource_node)

        # rejected node iterator
        for node in rejected_node:
            policy_dict[node.policy.displayName].append(node)

    return policy_dict
Exemplo n.º 4
0
def create_policy_dict(projects):
    """ Creates a dict of policies and the rejected libs by them"""

    policy_dict = defaultdict(list)

    # project iterator
    for project, resource_node in projects:
        rejected_node = PolicyCheckResourceNode.find_rejected_node(resource_node)

        # rejected node iterator
        for node in rejected_node:
            policy_dict[node.policy.displayName].append(node)

    return policy_dict