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

New module - elb_target #26483

Merged
merged 12 commits into from
Feb 7, 2018
Merged

New module - elb_target #26483

merged 12 commits into from
Feb 7, 2018

Conversation

wimnat
Copy link
Contributor

@wimnat wimnat commented Jul 6, 2017

SUMMARY

New module - elb_target

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

elb_target

ANSIBLE VERSION
2.5
ADDITIONAL INFORMATION

@willthames @s-hertel

@ansibot ansibot added WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers. affects_2.4 This issue/PR affects Ansible v2.4 aws cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. 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 Jul 6, 2017
@wimnat
Copy link
Contributor Author

wimnat commented Jul 6, 2017

@jbscare

@ansibot
Copy link
Contributor

ansibot commented Jul 6, 2017

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

lib/ansible/modules/cloud/amazon/elb_target.py:72:1: W293 blank line contains whitespace
lib/ansible/modules/cloud/amazon/elb_target.py:80:1: W293 blank line contains whitespace

click here for bot help

@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. and removed community_review In order to be merged, this PR must follow the community review workflow. labels Jul 6, 2017
@nitzmahone nitzmahone removed the needs_triage Needs a first human triage before being processed. label Jul 6, 2017
@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed module This issue/PR relates to a module. new_module This PR includes a new module. ci_verified Changes made in this PR are causing tests to fail. labels Jul 7, 2017
"""

try:
return connection.describe_target_health(TargetGroupArn=tg_arn, Targets=target)['TargetHealthDescriptions'][0]
Copy link
Contributor

Choose a reason for hiding this comment

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

If the TargetHealthDescriptions are an empty list this will fail. Maybe check if it exists and if not return an empty dict?
Traceback:

The full traceback is:
Traceback (most recent call last):
  File "/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py", line 245, in <module>
    main()
  File "/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py", line 242, in main
    deregister_target(connection, module)
  File "/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py", line 205, in deregister_target
    target_descriptions = describe_targets(connection, module, target_group_arn, [])
  File "/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py", line 125, in describe_targets
    return connection.describe_target_health(TargetGroupArn=tg_arn, Targets=target)['TargetHealthDescriptions'][0]
IndexError: list index out of range

fatal: [localhost]: FAILED! => {
    "changed": false,
    "failed": true,
    "module_stderr": "Traceback (most recent call last):\n  File \"/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py\", line 245, in <module>\n    main()\n  File \"/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py\", line 242, in main\n    deregister_target(connection, module)\n  File \"/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py\", line 205, in deregister_target\n    target_descriptions = describe_targets(connection, module, target_group_arn, [])\n  File \"/var/folders/by/k8_fbl593dlctgqmwq5wzl2c0000gn/T/ansible_mqh88b9h/ansible_module_elb_target.py\", line 125, in describe_targets\n    return connection.describe_target_health(TargetGroupArn=tg_arn, Targets=target)['TargetHealthDescriptions'][0]\nIndexError: list index out of range\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 0
}

PLAY RECAP *************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, what if the target has been registered on multiple ports (since running the playbook with a new port doesn't deregister the target with the old port)? Should those be in the returned info as well, instead of just the first item in the list?

@ansibot ansibot added module This issue/PR relates to a module. new_module This PR includes a new module. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jul 18, 2017
@ansibot ansibot removed the support:core This issue/PR relates to code supported by the Ansible Engineering Team. label Aug 16, 2017
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Aug 29, 2017
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 7, 2017
@kernow
Copy link
Contributor

kernow commented Sep 22, 2017

@wimnat I've been using this module and encountered an issue with the way you are handling existing targets, attempting to register or deregister an existing target causes an exception. In both register_target and deregister_target the code relies on the Reason being supplied in the TargetHealth object. This fails when the targets health state is healthy as the Reason is not supplied by the api when the state is healthy. See: TargetHealth API docs

As the State may or may not be returned I believe you will first need to check if the State is present, if it's not then check if a Reason is present, then check for the value of the Reason

@ansibot
Copy link
Contributor

ansibot commented Feb 6, 2018

Components

lib/ansible/modules/cloud/amazon/elb_target.py
support: community
maintainers:

test/integration/targets/elb_target/aliases
support: community
maintainers:

test/integration/targets/elb_target/defaults/main.yml
support: community
maintainers:

test/integration/targets/elb_target/tasks/main.yml
support: community
maintainers:

Metadata

waiting_on: wimnat
changes_requested_by: null
needs_info: False
needs_revision: True
needs_rebase: False
merge_commits: []
mergeable_state: clean
shippable_status: success
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

@s-hertel
Copy link
Contributor

s-hertel commented Feb 6, 2018

!needs_revision

@tedder
Copy link
Contributor

tedder commented Feb 6, 2018

testing locally.

@tedder
Copy link
Contributor

tedder commented Feb 6, 2018

fixes my objection. shipit.

@s-hertel
Copy link
Contributor

s-hertel commented Feb 6, 2018

The bot was needs revision because there was an @ in a commit message. I rebased to remove that from the commit message.

@ansibot
Copy link
Contributor

ansibot commented Feb 7, 2018

@Constantin007 @Constantin07 @Deepakkothandan @Etherdaemon @Java1Guy @Lujeni @Madhura-CSI @MichaelBaydoun @Sodki @adq @akazakov @alachaum @amir343 @anryko @bekelchik @bpennypacker @brandond @carsongee @defunctio @dkhenry @fiunchinho @fivethreeo @garethr @gunzy83 @gurumaia @hsingh @hyperized @iiibrad @infectsoldier @j-carl @jarv @Java1Guy @jimbydamonk @jmenga @joelthompson @jonhadfield @jonmer85 @joshsouza @jsdalton @jsmartin @kaczynskid @leedm777 @linuxdynasty @loia @lwade @MichaelBaydoun @michaeljs1990 @minichate @mjschultz @mmochan @nadirollo @nand0p @naslanidis @nickball @orthanc @piontas @pjodouin @prasadkatti @psykotox @pwnall @raags @rickmendes @roadmapper @ryansydnor @scicoin-project @scottanderson42 @shepdelacreme @silviud @steynovich @tastychutney @tedder @tgerla @timmahoney @tombamford @tsiganenok @viper233 @whiter @wilvk @zacblazic @zbal @zeekin @zimbatm

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 needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Feb 7, 2018
@ryansb ryansb merged commit 9451212 into ansible:devel Feb 7, 2018
@wimnat wimnat deleted the feature/elb_target branch May 8, 2018 05:37
@dagwieers dagwieers added nxos Cisco NXOS community cisco Cisco technologies networking Network category labels Feb 22, 2019
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 aws cisco Cisco technologies cloud community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. networking Network category new_module This PR includes a new module. new_plugin This PR includes a new plugin. nxos Cisco NXOS community support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet