Fix linting. Fix collection structure

This commit is contained in:
Victor Zemtsov 2022-08-09 14:39:08 +03:00
parent da0e5f125c
commit e57cd7b6b1
4 changed files with 15 additions and 11 deletions

3
.flake8 Normal file
View File

@ -0,0 +1,3 @@
[flake8]
max-line-length = 88
extend-ignore = E203

View File

@ -15,7 +15,7 @@ The UNIX socket file is stored in a temporary folder according to OS.
Requirements: `python 3`, `pykeepass==4.0.3`
pip install 'pykeepass==4.0.3' --user
ansible-galaxy install viczem.keepass
ansible-galaxy collection install viczem.keepass
## Variables

2
meta/runtime.yml Normal file
View File

@ -0,0 +1,2 @@
requires_ansible: ">=2.10"

View File

@ -26,21 +26,21 @@ DOCUMENTATION = """
version_added: '0.5.0'
short_description: Fetching data from KeePass file
description:
- This lookup returns a value of a property of a KeePass entry
- This lookup returns a value of a property of a KeePass entry
- which fetched by given path
options:
_terms:
description:
description:
- first is a path to KeePass entry
- second is a property name of the entry, e.g. username or password
required: True
notes:
- https://github.com/viczem/ansible-keepass
examples:
- "{{ lookup('keepass', 'path/to/entry', 'username') }}"
- "{{ lookup('keepass', 'path/to/entry', 'password') }}"
- "{{ lookup('keepass', 'path/to/entry', 'custom_properties', 'a_custom_property_name') }}"
- "{{ lookup('keepass', 'path/to/entry', 'custom_properties', 'my_prop_name') }}"
"""
@ -270,7 +270,7 @@ def _keepass_socket(kdbx, kdbx_key, sock_path, ttl=60, kdbx_password=None):
if entry is None:
conn.send(
_resp("fetch", 1, "path '%s' is not found".format(path))
_resp("fetch", 1, "path '%s' is not found" % path)
)
break
@ -281,8 +281,7 @@ def _keepass_socket(kdbx, kdbx_key, sock_path, ttl=60, kdbx_password=None):
_resp(
"fetch",
1,
"custom_property key is not set "
"for '%s'".format(arg[0]),
"no custom_property key for '%s'" % arg[0],
)
)
break
@ -293,8 +292,8 @@ def _keepass_socket(kdbx, kdbx_key, sock_path, ttl=60, kdbx_password=None):
_resp(
"fetch",
1,
"custom_property '%s' is not found "
"for '%s'".format(prop_key, path),
"custom_property '%s' is not found for '%s'"
"" % (prop_key, path),
)
)
break
@ -312,7 +311,7 @@ def _keepass_socket(kdbx, kdbx_key, sock_path, ttl=60, kdbx_password=None):
_resp(
"fetch",
1,
"unknown property '%s' for '%s'".format(prop, path),
"unknown property '%s' for '%s'" % (prop, path),
)
)
break