New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #45983: Add gluster_heal_facts module for Gluster storage. #45997

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
4 participants
@devyanikota
Contributor

devyanikota commented Sep 21, 2018

This module will add support to extract self-heal status of a cluster
and return the number of files that are still in progress for the
healing process to complete.

Signed-off-by: Devyani Kota dkota@redhat.com

SUMMARY

Fixes #45983 : Adds gluster_heal_facts module

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

storage/glusterfs/gluster_heal_facts

ANSIBLE VERSION
ansible 2.4.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/devyani/work/gdeploy/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.13 (default, Dec  1 2017, 09:21:53) [GCC 6.4.1 20170727 (Red Hat 6.4.1-1)]

ADDITIONAL INFORMATION

In a cluster, when a brick goes offline and comes back online, self-heal needs to be
triggered to bring all the replicas in sync.
This module will help list the files that still need to be healed, and the ones that have healed.
gluster volume heal test-volume info

Brick server1:/glusterfs/test-volume_0
Number of entries: 0
 
Brick server2:/glusterfs/test-volume_1
Number of entries: 101 
/95.txt
/32.txt
/66.txt
/35.txt
@ansibot

This comment has been minimized.

Contributor

ansibot commented Sep 21, 2018

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ 	]*//g; s/[ 	]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Makefile:95: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 720, in <module>
    main()
  File "../bin/plugin_formatter.py", line 678, in main
    plugin_info, categories = get_plugin_info(options.module_dir, limit_to=options.limit_to, verbose=(options.verbosity > 0))
  File "../bin/plugin_formatter.py", line 269, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 100, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 62, in read_docstring
    data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
  File "/usr/local/lib/python3.6/dist-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/local/lib/python3.6/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/local/lib/python3.6/dist-packages/yaml/parser.py", line 439, in parse_block_mapping_key
    "expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 10, column 5:
        heal_status:
        ^
expected <block end>, but found '<block mapping start>'
  in "<unicode string>", line 18, column 7:
          default: False
          ^
make: *** [modules] Error 1

The test ansible-test sanity --test boilerplate [explain] failed with 2 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: missing: from __future__ import (absolute_import, division, print_function)

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:90:25: E124 closing bracket does not match visual indentation

The test ansible-test sanity --test validate-modules [explain] failed with 4 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E317 "heal_type" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E317 "volume_name" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:29:7: E302 DOCUMENTATION is not valid YAML
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:50:1: E313 RETURN is not valid YAML

The test ansible-test sanity --test yamllint [explain] failed with 2 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:29:7: error DOCUMENTATION: syntax error: expected <block end>, but found '<block mapping start>'
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:50:1: error RETURN: syntax error: found unexpected end of stream

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Oct 23, 2018

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: has a documentation error formatting or is missing documentation.

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ 	]*//g; s/[ 	]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Makefile:93: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 720, in <module>
    main()
  File "../bin/plugin_formatter.py", line 678, in main
    plugin_info, categories = get_plugin_info(options.module_dir, limit_to=options.limit_to, verbose=(options.verbosity > 0))
  File "../bin/plugin_formatter.py", line 269, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 99, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 62, in read_docstring
    data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
  File "/usr/local/lib/python3.6/dist-packages/yaml/constructor.py", line 35, in get_single_data
    node = self.get_single_node()
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/usr/local/lib/python3.6/dist-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/usr/local/lib/python3.6/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/local/lib/python3.6/dist-packages/yaml/parser.py", line 439, in parse_block_mapping_key
    "expected <block end>, but found %r" % token.id, token.start_mark)
yaml.parser.ParserError: while parsing a block mapping
  in "<unicode string>", line 10, column 5:
        heal_status:
        ^
expected <block end>, but found '<block mapping start>'
  in "<unicode string>", line 18, column 7:
          default: False
          ^
make: *** [modules] Error 1

The test ansible-test sanity --test boilerplate [explain] failed with 2 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: missing: from __future__ import (absolute_import, division, print_function)

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:90:25: E124 closing bracket does not match visual indentation

The test ansible-test sanity --test validate-modules [explain] failed with 4 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E317 "heal_type" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E317 "volume_name" is marked as required but specifies a default. Arguments with a default should not be marked as required
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:29:7: E302 DOCUMENTATION is not valid YAML
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:50:1: E313 RETURN is not valid YAML

The test ansible-test sanity --test yamllint [explain] failed with 2 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:29:7: error DOCUMENTATION: syntax error: expected <block end>, but found '<block mapping start>'
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:50:1: error RETURN: syntax error: found unexpected end of stream

click here for bot help

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch 2 times, most recently from d7e6d63 to a2c8e56 Oct 25, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Oct 25, 2018

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
11, column 8, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
11, column 8, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
11, column 8, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
11, column 8, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
11, column 8, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ 	]*//g; s/[ 	]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
rendering: gluster_heal_facts (2010 previous rendering line(s) omitted)
Makefile:93: recipe for target 'modules' failed
--> Standard Error
[WARNING]: While constructing a mapping from
../../lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line 11,
column 8, found a duplicate dict key (default). Using last defined value only.
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 720, in <module>
    main()
  File "../bin/plugin_formatter.py", line 707, in main
    process_plugins(plugin_info, templates, outputname, output_dir, options.ansible_version, plugin_type)
  File "../bin/plugin_formatter.py", line 525, in process_plugins
    text = templates['plugin'].render(doc)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "../templates/plugin.rst.j2", line 323, in top-level template code
    {% for key, value in returndocs|dictsort recursive -%}
  File "/usr/local/lib/python3.6/dist-packages/jinja2/filters.py", line 242, in do_dictsort
    return sorted(value.items(), key=sort_func, reverse=reverse)
AttributeError: 'list' object has no attribute 'items'
make: *** [modules] Error 1

The test ansible-test sanity --test validate-modules [explain] failed with 7 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E319 RETURN: expected a dictionary
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E322 "heal_type" is listed in the argument_spec, but not documented in the module
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E322 "name" is listed in the argument_spec, but not documented in the module
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E322 "volume" is listed in the argument_spec, but not documented in the module
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E323 "heal_status" is listed in DOCUMENTATION.options, but not accepted by the module
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E324 Value for "default" from the argument_spec ('self-heal') for "heal_type" does not match the documentation (None)
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E326 Value for "choices" from the argument_spec (['self-heal', 'rebalance']) for "heal_type" does not match the documentation ([])

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:32:8: key-duplicates DOCUMENTATION: duplication of key "default" in mapping

click here for bot help

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch from a2c8e56 to 4aa5201 Oct 25, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Oct 25, 2018

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
16, column 5, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
16, column 5, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
16, column 5, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
16, column 5, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with the error:

Output on stderr from ansible-doc is considered an error.

Command "ansible-doc -t module gluster_heal_facts" returned exit status 0.
>>> Standard Error
[WARNING]: While constructing a mapping from
/root/ansible/lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line
16, column 5, found a duplicate dict key (default). Using last defined value
only.

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ 	]*//g; s/[ 	]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
rendering: gluster_heal_facts (2010 previous rendering line(s) omitted)
Makefile:93: recipe for target 'modules' failed
--> Standard Error
[WARNING]: While constructing a mapping from
../../lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py, line 16,
column 5, found a duplicate dict key (default). Using last defined value only.
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 720, in <module>
    main()
  File "../bin/plugin_formatter.py", line 707, in main
    process_plugins(plugin_info, templates, outputname, output_dir, options.ansible_version, plugin_type)
  File "../bin/plugin_formatter.py", line 525, in process_plugins
    text = templates['plugin'].render(doc)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "../templates/plugin.rst.j2", line 323, in top-level template code
    {% for key, value in returndocs|dictsort recursive -%}
  File "/usr/local/lib/python3.6/dist-packages/jinja2/filters.py", line 242, in do_dictsort
    return sorted(value.items(), key=sort_func, reverse=reverse)
AttributeError: 'list' object has no attribute 'items'
make: *** [modules] Error 1

The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E319 RETURN: expected a dictionary
lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E324 Value for "default" from the argument_spec ('self-heal') for "heal_type" does not match the documentation ('False')

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:37:5: key-duplicates DOCUMENTATION: duplication of key "default" in mapping

click here for bot help

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch from 4aa5201 to aad2bf2 Oct 25, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Oct 25, 2018

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E312 No RETURN provided

click here for bot help

@ansibot ansibot added the ci_verified label Oct 25, 2018

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch from aad2bf2 to cea2e7c Oct 25, 2018

@ansibot ansibot removed the ci_verified label Oct 25, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Oct 25, 2018

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
cat _themes/srtd/static/css/theme.css | sed -e 's/^[ 	]*//g; s/[ 	]*$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$/d' | sed -e :a -e '$!N; s/\n\(.\)/\1/; ta' > _themes/srtd/static/css/theme.min.css
PYTHONPATH=../../lib ../bin/dump_config.py --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ -d ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../bin/generate_man.py --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../bin/dump_keywords.py --template-dir=../templates --output-dir=rst/reference_appendices/ -d ./keyword_desc.yml
PYTHONPATH=../../lib ../bin/plugin_formatter.py -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
rendering: gluster_heal_facts (2010 previous rendering line(s) omitted)
Makefile:93: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../bin/plugin_formatter.py", line 720, in <module>
    main()
  File "../bin/plugin_formatter.py", line 707, in main
    process_plugins(plugin_info, templates, outputname, output_dir, options.ansible_version, plugin_type)
  File "../bin/plugin_formatter.py", line 525, in process_plugins
    text = templates['plugin'].render(doc)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "../templates/plugin.rst.j2", line 323, in top-level template code
    {% for key, value in returndocs|dictsort recursive -%}
  File "/usr/local/lib/python3.6/dist-packages/jinja2/filters.py", line 242, in do_dictsort
    return sorted(value.items(), key=sort_func, reverse=reverse)
AttributeError: 'list' object has no attribute 'items'
make: *** [modules] Error 1

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/storage/glusterfs/gluster_heal_facts.py:0:0: E319 RETURN: expected a dictionary

click here for bot help

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch from cea2e7c to 6e81ae6 Oct 25, 2018

@ansibot

This comment has been minimized.

Contributor

ansibot commented Oct 25, 2018

@rosmo @sac

As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add shipit if you would like to see it merged.

click here for bot help

DOCUMENTATION = '''
---
module: gluster_heal_facts
short_description: Retrieve facts about one or more Gluster hosts

This comment has been minimized.

@sac

sac Oct 26, 2018

Contributor

This should be: "Gather facts about self-heal status"

It is not facts about Gluster hosts.

This comment has been minimized.

@devyanikota

devyanikota Nov 2, 2018

Contributor

Done.

author: "Devyani Kota (@devyanikota)"
version_added: "2.8"
description:
- Retrieve facts about one or more Gluster hosts.

This comment has been minimized.

@sac

sac Oct 26, 2018

Contributor

Same as above

This comment has been minimized.

@devyanikota

devyanikota Nov 2, 2018

Contributor

Done.

- The volume name.
required: true
aliases: ['volume']
heal_type:

This comment has been minimized.

@sac

sac Oct 26, 2018

Contributor

heal_type key is misleading. Can you change it to: `filter' (The filter can be of self-heal or rebalance)

This comment has been minimized.

@devyanikota

devyanikota Nov 2, 2018

Contributor

@sac 'filter' happens to be a keyword, changing it to 'status_filter'. Hope that looks ok?

default: "self-heal"
choices: ["self-heal", "rebalance"]
description:
- Determines which status is to be returned. If the heal_status is

This comment has been minimized.

@sac

sac Oct 26, 2018

Contributor

s/status is/facts are/

Since we are returning the facts, which also includes status.

This comment has been minimized.

@devyanikota

devyanikota Nov 2, 2018

Contributor

Done.

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
glusterbin = ''

This comment has been minimized.

@sac

sac Oct 26, 2018

Contributor

Where is this value set?

This comment has been minimized.

@devyanikota

devyanikota Nov 2, 2018

Contributor

Rectified. Thanks.

def get_rebalance_status(name):
out = run_gluster(['volume', 'rebalance', name, 'status'])

This comment has been minimized.

@sac

sac Oct 26, 2018

Contributor

The data has to be parsed, and the facts have to be sorted out.
Like:

  • Number of files pending heal.
  • Number of files to be rebalanced
    etc based on the data thrown by the heal status.

Just dumping the string as is, does not add any value to the facts module.
The end user should be able to see particular keys and make any decision.
This way, we are shifting the responsibility of parsing the data on the caller.

This comment has been minimized.

@sac

sac Nov 3, 2018

Contributor

@devyanikota you have not addressed this comment.

This comment has been minimized.

@devyanikota

devyanikota Nov 5, 2018

Contributor

@sac yes, working on it. Seems like the dictionary of bricks is not enough to allow the caller to re-use the output. Trying to extract the data from the tabular format to a mapped dictionary to allow reusability.

This comment has been minimized.

@devyanikota

devyanikota Nov 22, 2018

Contributor

@sac modified the output, returns a dictionary of the host and the number of files that need healing.
Please review the same. Thanks.

still in process are returned. If heal_status is rebalance,
rebalance status is returned.
requirements:
- GlusterFS > 3.2

This comment has been minimized.

@sac

sac Oct 26, 2018

Contributor

Where are we checking if the GlusterFS version is indeed > 3.2
Refer the peer module.

This comment has been minimized.

@devyanikota

devyanikota Nov 2, 2018

Contributor

Rectified. Added checks for GlusterFS versions.

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch 2 times, most recently from fc0c7e5 to 29bd414 Nov 2, 2018

def get_rebalance_status(name):
out = run_gluster(['volume', 'rebalance', name, 'status'])

This comment has been minimized.

@sac

sac Nov 3, 2018

Contributor

@devyanikota you have not addressed this comment.

@ansibot ansibot added the stale_ci label Nov 13, 2018

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch from 29bd414 to 5b455c7 Nov 22, 2018

@ansibot ansibot removed the stale_ci label Nov 22, 2018

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch 2 times, most recently from 9c8e4ee to 990f2c1 Nov 22, 2018

# If the installed version is less than 3.2, it is an invalid version
# return True
return LooseVersion(version) < LooseVersion(required_version)

This comment has been minimized.

@sac

sac Nov 26, 2018

Contributor

Can you move this function above main() as per ansible guildelines:

"
Ansible follows C-style code flow where the caller functions/methods are towards the bottom of the file and the callee implementations are above them.
"

)
module = AnsibleModule(argument_spec)
global glusterbin

This comment has been minimized.

@sac

sac Nov 26, 2018

Contributor

Can you move the global declarations to one place? Easy for the future maintainer.

def main():
global module
argument_spec = dict(name=dict(type='str', required=True, aliases=['volume']),
status_filter=dict(default='self-heal', choices=['self-heal', 'rebalance']),

This comment has been minimized.

@sac
def get_self_heal_status(name):
out = run_gluster(['volume', 'heal', name, 'info'])

This comment has been minimized.

@sac

sac Nov 26, 2018

Contributor

Since you're screenscraping, set the locale to C before scraping.

See: gluster_peer

rc, out, err = module.run_command(args, **kwargs)
if rc != 0:
module.fail_json(msg='error running gluster (%s) command (rc=%d): %s' %
(' '.join(args), rc, out or err), exception=traceback.format_exc())

This comment has been minimized.

@sac

sac Nov 26, 2018

Contributor

If rc != 0 it is always err. You don't need out or err.

def get_rebalance_status(name):
out = run_gluster(['volume', 'rebalance', name, 'status'])
return out

This comment has been minimized.

@sac

sac Nov 26, 2018

Contributor

You have not addressed rebalance?

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch 3 times, most recently from 474422d to a65bfd9 Nov 26, 2018

Fixes #45983: Add gluster_heal_facts module for Gluster storage.
This module will add support to extract self-heal status of a cluster
and return the number of files that are still in progress for the
healing process to complete.

Signed-off-by: Devyani Kota <dkota@redhat.com>

@devyanikota devyanikota force-pushed the devyanikota:gluster/self_heal branch from a65bfd9 to a3a004c Nov 30, 2018

@ansibot ansibot added the stale_ci label Dec 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment