Skip to content
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

Adding custom module to get PID of the process #50896

Merged
merged 3 commits into from
Feb 16, 2019

Conversation

saranyasridharan
Copy link
Contributor

SUMMARY
This module will find the pid of the given process name either locally or in remote system, depending on the host parameter.

ISSUE TYPE

New Module Pull Request
COMPONENT NAME
pids

ANSIBLE VERSION
ansible 2.8.0.dev0 last updated 2018/08/07 12:03:58 (GMT +550)
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/ansible/newcode/library']
ansible python module location = /home/ansible/lib/ansible
executable location = /home/ansible/bin/ansible
python version = 2.7.5 (default, Jul 13 2018, 13:06:57) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]

ADDITIONAL INFORMATION
I have used psutil module to find the process IDs(PIDs) of the given process

@ansibot
Copy link
Contributor

ansibot commented Jan 14, 2019

@saranyasridharan this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jan 14, 2019

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

lib/ansible/modules/system/pids.py:61:30: bad-whitespace No space allowed after keyword argument assignment             name=dict(required= True, type= "str"),                               ^
lib/ansible/modules/system/pids.py:61:42: bad-whitespace No space allowed after keyword argument assignment             name=dict(required= True, type= "str"),                                           ^

The test ansible-test sanity --test pep8 [explain] failed with 5 errors:

lib/ansible/modules/system/pids.py:61:32: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/pids.py:61:44: E251 unexpected spaces around keyword / parameter equals
lib/ansible/modules/system/pids.py:63:1: E101 indentation contains mixed spaces and tabs
lib/ansible/modules/system/pids.py:63:1: W191 indentation contains tabs
lib/ansible/modules/system/pids.py:64:1: E101 indentation contains mixed spaces and tabs

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

test/integration/targets/pids/tasks/main.yml:1:1: empty-lines too many blank lines (1 > 0)

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 merge_commit This PR contains at least one merge commit. Please resolve! module This issue/PR relates to a module. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. new_module This PR includes a new module. new_plugin This PR includes a new plugin. support:community This issue/PR relates to code supported by the Ansible community. labels Jan 14, 2019
@mattclay
Copy link
Member

@saranyasridharan This PR has a merge commit in it. Have you tried going through the rebasing instructions? If you need help with that, feel free to ask here or in IRC on Freenode in the #ansible-devel channel.

@saranyasridharan
Copy link
Contributor Author

@mattclay. I am trying this steps for rebasing

  1. set the remote repository
  2. git rebase upstream devel.

Is it right way ?

	new file:   ../../../../lib/ansible/modules/system/pids.py
	new file:   aliases
	new file:   files/obtainpid.sh
	new file:   tasks/main.yml
@ansibot
Copy link
Contributor

ansibot commented Jan 14, 2019

@AugustusKling @ColOfAbRiX @EvanK @LinusU @Mogztter @MorrisA @abulimov @adejoux @ahtik @azaghal @bgurney-rh @dankeder @davidobrien1985 @davixx @dirtyharrycallahan @dougluce @dsummersl @flynn1973 @gforster @giovannisciortino @goozbach @groks @haad @hryamzik @indrajitr @jasperla @jbenden @jdauphant @jhoekx @jsumners @jtyr @kairoaraujo @kevensen @lberruti @mattjeffery @matze @mcv21 @molekuul @mpdehaan @mulby @natefoo @nibalizer @obourdon @ovcharenko @pilou- @pmarkham @pyykkis @rhaido @risaacson @ryan_sb @saito-hideki @sebastiendarocha @sfromm @srvg @tacatac @tdtrask @tmshn @xen0l

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

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jan 14, 2019
@mattclay
Copy link
Member

@saranyasridharan Yes, it looks correct now. I'm seeing just your commits on the PR.

@saranyasridharan
Copy link
Contributor Author

@felixfontein I have recreated this PR for the same module. Can you please review it once ?

lib/ansible/modules/system/pids.py Outdated Show resolved Hide resolved
lib/ansible/modules/system/pids.py Outdated Show resolved Hide resolved
lib/ansible/modules/system/pids.py Show resolved Hide resolved
lib/ansible/modules/system/pids.py Outdated Show resolved Hide resolved
lib/ansible/modules/system/pids.py Show resolved Hide resolved
lib/ansible/modules/system/pids.py Outdated Show resolved Hide resolved
@@ -0,0 +1,59 @@
# Test code for the pid module
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Test code for the pid module
# Test code for the pids module

@@ -0,0 +1,59 @@
# Test code for the pid module
# Copyright 2019, Saranya Sridharan
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Copyright 2019, Saranya Sridharan
# Copyright: (c) 2019, Saranya Sridharan

DOCUMENTATION = '''
module: pids
version_added: 2.8
description: "Retrieves a list of process IDs (PIDs) of all processes of the given name. Returns an empty list if no process of the given name exists."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add a note - From where this module will gather information about PIDs viz., Ansible Controller or Managed nodes or remote machines.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jan 15, 2019
@saranyasridharan
Copy link
Contributor Author

@Akasurde thanks for the review comments. I have addressed the changes. Please let me know if anything else it needed.

@saranyasridharan
Copy link
Contributor Author

@saranyasridharan Yes, it looks correct now. I'm seeing just your commits on the PR.

Thanks @mattclay. if the PR is good to go, Can you please mark it as shipit ?

@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jan 15, 2019
@saranyasridharan
Copy link
Contributor Author

@Akasurde . Can you please let me know if the addressed changes are as expected ?

@saranyasridharan
Copy link
Contributor Author

@Akasurde @mattclay Can you please mark it as shipit , if no changes are required then ?
Thank you

@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. labels Jan 25, 2019
@mattclay mattclay removed the needs_triage Needs a first human triage before being processed. label Feb 16, 2019
@mattclay mattclay merged commit 1db6d55 into ansible:devel Feb 16, 2019
@mattclay
Copy link
Member

@saranyasridharan Thank you for contributing a new module with tests.

@saranyasridharan
Copy link
Contributor Author

@saranyasridharan Thank you for contributing a new module with tests.

Thanks @mattclay for the review comments and support provided throughout my learning and contribution.

@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. new_module This PR includes a new module. new_plugin This PR includes a new plugin. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. stale_review Updates were made after the last review and the last review is more than 7 days old. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants