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

add osquery_facts module; closes #14066 #22467

Open
wants to merge 4 commits into
base: devel
from

Conversation

Projects
None yet
6 participants
@rmetzler
Contributor

rmetzler commented Mar 9, 2017

SUMMARY

This module adds basic support for osquery.

The queries are run via the osqueryi cli with the --json flag to enable easy parsing.
I wasn't sure whether to use set_facts or return the resulting array of dicts and let the user register the variable. I went with the second option mainly because I think the design is simpler.

This is my first module and I didn't wrote any python for a couple of years. Please let me know what I can improve.

There is a feature request #14066, which I hope to close.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

osquery_facts

ANSIBLE VERSION
ansible 2.2.0.0
  config file = /usr/local/etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
ADDITIONAL INFORMATION

@ansibot

This comment has been minimized.

Contributor

ansibot commented Mar 9, 2017

The test ansible-test sanity --test validate-modules failed with the following error:

lib/ansible/modules/system/osquery_facts.py:0:0: E201 Did not find a module_utils import

click here for bot help

@sivel

Facts modules need to return the facts in an ansible_facts key.

Additionally due to this they likely need to be namespaces into a osquery key.

lib/ansible/modules/system/osquery_facts.py Outdated
type: json
'''
from module_utils.basic import AnsibleModule

This comment has been minimized.

@sivel

sivel Mar 9, 2017

Member

This needs to be from ansible.module_utils...

This comment has been minimized.

@rmetzler

rmetzler Mar 10, 2017

Contributor

done

@rmetzler

This comment has been minimized.

Contributor

rmetzler commented Mar 10, 2017

ready_for_review

didn't see the bot's help text

@s-hertel s-hertel removed the needs_triage label Mar 10, 2017

@rmetzler

This comment has been minimized.

Contributor

rmetzler commented Mar 10, 2017

ready_for_review

@ansibot

This comment has been minimized.

lib/ansible/modules/system/osquery_facts.py Outdated
DOCUMENTATION = '''
---
module: osquery_facts
version_added: "2.3"

This comment has been minimized.

@agaffney

agaffney Nov 29, 2017

Contributor

This should probably be 2.5

This comment has been minimized.

@rmetzler

rmetzler Dec 7, 2017

Contributor

fixed

@sivel

sivel approved these changes Dec 5, 2017

@ansibot ansibot removed the stale_review label Dec 5, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 7, 2017

@rmetzler this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 7, 2017

The test ansible-test sanity --test boilerplate [?] failed with the following error:

Command "test/sanity/code-smell/boilerplate.sh" returned exit status 2.
>>> Standard Output
== Missing __metaclass__ = type ==
./lib/ansible/modules/system/osquery_facts.py

== Missing from __future__ import (absolute_import, division, print_function) ==
./lib/ansible/modules/system/osquery_facts.py

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/system/osquery_facts.py:2:1: E265 block comment should start with '# '
lib/ansible/modules/system/osquery_facts.py:70:1: E302 expected 2 blank lines, found 1

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/system/osquery_facts.py:0:0: E316 ANSIBLE_METADATA.metadata_version: required key not provided @ data['metadata_version']. Got None
lib/ansible/modules/system/osquery_facts.py:0:0: E316 ANSIBLE_METADATA.version: extra keys not allowed @ data['version']. Got '1.0'
lib/ansible/modules/system/osquery_facts.py:0:0: E319 RETURN.value.type: not a valid value for dictionary value @ data['type']. Got 'json'

click here for bot help

@ansibot ansibot removed the needs_rebase label Dec 13, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 13, 2017

The test ansible-test sanity --test boilerplate [?] failed with the following error:

Command "test/sanity/code-smell/boilerplate.sh" returned exit status 2.
>>> Standard Output
== Missing __metaclass__ = type ==
./lib/ansible/modules/system/osquery_facts.py

== Missing from __future__ import (absolute_import, division, print_function) ==
./lib/ansible/modules/system/osquery_facts.py

The test ansible-test sanity --test pep8 [?] failed with the following errors:

lib/ansible/modules/system/osquery_facts.py:2:1: E265 block comment should start with '# '
lib/ansible/modules/system/osquery_facts.py:70:1: E302 expected 2 blank lines, found 1

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/system/osquery_facts.py:0:0: E316 ANSIBLE_METADATA.metadata_version: required key not provided @ data['metadata_version']. Got None
lib/ansible/modules/system/osquery_facts.py:0:0: E316 ANSIBLE_METADATA.version: extra keys not allowed @ data['version']. Got '1.0'
lib/ansible/modules/system/osquery_facts.py:0:0: E319 RETURN.value.type: not a valid value for dictionary value @ data['type']. Got 'json'

click here for bot help

@rmetzler rmetzler force-pushed the rmetzler:osquery-facts branch Dec 13, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 13, 2017

The test ansible-test sanity --test pep8 [?] failed with the following error:

lib/ansible/modules/system/osquery_facts.py:71:1: E302 expected 2 blank lines, found 1

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/system/osquery_facts.py:0:0: E101 Interpreter line is not "#!/usr/bin/python"
lib/ansible/modules/system/osquery_facts.py:0:0: E316 ANSIBLE_METADATA.metadata_version: not a valid value for dictionary value @ data['metadata_version']. Got '1.0'
lib/ansible/modules/system/osquery_facts.py:0:0: E319 RETURN.value.type: required key not provided @ data['type']. Got None

click here for bot help

@ansibot ansibot added the ci_verified label Dec 13, 2017

@rmetzler rmetzler force-pushed the rmetzler:osquery-facts branch Dec 13, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 13, 2017

The test ansible-test sanity --test pep8 [?] failed with the following error:

lib/ansible/modules/system/osquery_facts.py:73:1: E302 expected 2 blank lines, found 1

The test ansible-test sanity --test validate-modules [?] failed with the following error:

lib/ansible/modules/system/osquery_facts.py:0:0: E319 RETURN.value.type: not a valid value for dictionary value @ data['type']. Got 'ansible_facts'

click here for bot help

@rmetzler rmetzler force-pushed the rmetzler:osquery-facts branch Dec 13, 2017

@ansibot

This comment has been minimized.

Contributor

ansibot commented Dec 13, 2017

The test ansible-test sanity --test validate-modules [?] failed with the following errors:

lib/ansible/modules/system/osquery_facts.py:0:0: E319 RETURN.value.type: required key not provided @ data['type']. Got None
lib/ansible/modules/system/osquery_facts.py:23:0: E106 Import found before documentation variables. All imports must appear below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.
lib/ansible/modules/system/osquery_facts.py:23:0: E107 Imports should be directly below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.

click here for bot help

@rmetzler rmetzler force-pushed the rmetzler:osquery-facts branch to bd8abc4 Dec 13, 2017

@ansibot ansibot removed the ci_verified label Dec 13, 2017

@rmetzler

This comment has been minimized.

Contributor

rmetzler commented Dec 13, 2017

@ansibot bot broken ? I thought the label ci_verified means the PR passed all CI tests. But it seems it rather means the opposite.

@ansibot ansibot added the bot_broken label Dec 13, 2017

@sivel

This comment has been minimized.

Member

sivel commented Dec 13, 2017

Per the documentation, ci_verified means:

Identify pull requests for which CI failed. A pull request must successfully pass CI in order to be merged.

@sivel sivel removed the bot_broken label Dec 13, 2017

@ansibot ansibot added the bot_broken label Dec 13, 2017

@mattclay mattclay removed the bot_broken label Dec 15, 2017

@mattclay

This comment has been minimized.

Member

mattclay commented Dec 15, 2017

I've removed the broken label as the bot is functioning correctly.

@sivel Before removing the label, the comment that caused the label to be applied must be removed or edited to no longer contain the command. Otherwise the bot will re-apply the label.

@mattclay

This comment has been minimized.

Member

mattclay commented Feb 13, 2018

bot_status

@ansibot

This comment has been minimized.

Contributor

ansibot commented Feb 13, 2018

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

lib/ansible/modules/system/osquery_facts.py:0:0: E307 version_added should be 2.6. Currently 2.5

click here for bot help

@ansibot

This comment has been minimized.

Contributor

ansibot commented Feb 13, 2018

Components

lib/ansible/modules/system/osquery_facts.py
support: community
maintainers:

Metadata

waiting_on: rmetzler
changes_requested_by: null
needs_info: False
needs_revision: True
needs_rebase: False
merge_commits: []
mergeable_state: unstable
shippable_status: failure
maintainer_shipits (module maintainers): False
community_shipits (namespace maintainers): False
ansible_shipits (core team members): False
shipit_actors (maintainer or core team member): None
shipit_actors_other:

click here for bot help

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