Skip to content

Commit

Permalink
Fix README badge link (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak authored Sep 25, 2024
1 parent 88eede3 commit ad0c0b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Ansible Collection - nephelaiio.plugins

[![Build Status](https://github.com/nephelaiio/ansible-collection-plugins/actions/workflows/molecule.yml/badge.svg)](https://github.com/nephelaiio/ansible-collection-plugins/actions/wofklows/molecule.yml)
[![Build Status](https://github.com/nephelaiio/ansible-collection-plugins/actions/workflows/pytest.yml/badge.svg)](https://github.com/nephelaiio/ansible-collection-plugins/actions/wofklows/molecule.yml)
[![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-nephelaiio.plugins-blue.svg)](https://galaxy.ansible.com/ui/repo/published/nephelaiio/plugins/)

An [ansible collection](https://galaxy.ansible.com/ui/repo/published/nephelaiio/plugins/) for utility filters and tests

## Collection plugins

Filters:
### Filters:

- is_hash(d): Checks if the given object has a callable 'get' attribute.
- merge_dicts(x, y): Merges two dictionaries, with values from the second dictionary overwriting those from the first.
Expand Down Expand Up @@ -43,11 +43,10 @@ Filters:
- is_all_true(xs): Returns True if all elements in the provided iterable are truthy.
- search_regex(r, s): Checks if a string matches a given regex pattern.

Test:
### Tests:
- test_network(record=None, net="0.0.0.0/0", prop="ansible_host"): Tests if an IP address in a given record falls within a specified network range.
- test_property(record=None, regex=".*", prop=""): Tests if the value of a specified property in a given record matches a regular expression.


## Testing

Role is tested using molecule through Github Actions on Ubuntu latest. You can test the collection directly from sources using command `make test`
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: nephelaiio
name: plugins
version: 0.0.4
version: 0.0.5
readme: README.md
authors:
- Ted Cook <[email protected]>
Expand Down
7 changes: 7 additions & 0 deletions plugins/filter/custom_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ def alias_keys(d, alias=None):
new_dict[v] = new_dict[k]
return new_dict


def map_attributes(d, atts):
"""
Extracts values from the input dictionary (d) for the keys listed in atts.
Expand All @@ -306,6 +307,7 @@ def map_attributes(d, atts):
new_array = new_array + [d[k]]
return new_array


def select_attributes(d, atts):
"""
Creates a new dictionary containing only the key-value pairs from the input dictionary (d)
Expand All @@ -325,6 +327,7 @@ def select_attributes(d, atts):
new_dict[k] = d[k]
return new_dict


def drop_attributes(d, x):
"""
Returns a new dictionary with specified keys removed from the input dictionary (d).
Expand All @@ -343,6 +346,7 @@ def drop_attributes(d, x):
del new_dict[y]
return new_dict


def to_dict(x, key=None):
"""
Converts the input into a dictionary. If a key function or mapping is provided,
Expand All @@ -366,6 +370,7 @@ def to_dict(x, key=None):
result = {key: x}
return result


def merge_item(item, key_attr):
"""
Merges a tuple of two items (a key-value pair) into a single dictionary,
Expand All @@ -377,6 +382,7 @@ def merge_item(item, key_attr):

return dict(merge_dicts(item[1], to_dict(item[0], key_attr)))


def key_item(item, key_attr, remove_key=True):
"""
Extracts a value from the given item using a specified key or nested keys, and returns
Expand Down Expand Up @@ -454,6 +460,7 @@ def list_to_dict(l, key_attr, remove_key=True):

return dict([key_item(x, key_attr, remove_key) for x in l])


def to_kv(d, sep=".", prefix=""):
"""
Recursively converts a nested dictionary or list into a flat list of key-value pairs with compound keys.
Expand Down

0 comments on commit ad0c0b2

Please sign in to comment.