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

network command modules cleanup #45242

Merged
merged 6 commits into from
Sep 13, 2018
Merged

Conversation

Qalthos
Copy link
Contributor

@Qalthos Qalthos commented Sep 5, 2018

SUMMARY

This started as a cleanup to some useless code in ios_command, that then bled over to other command modules.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
ANSIBLE VERSION
2.8

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. module This issue/PR relates to a module. 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. networking Network category nxos Cisco NXOS community support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. support:network This issue/PR relates to code supported by the Ansible Network Team. labels Sep 5, 2018


def parse_commands(module, warnings):
spec = dict(
transform = ComplexList(dict(
Copy link
Member

Choose a reason for hiding this comment

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

Can the logic of creating ComplexList object moved to a common location with the updated spec. This change can add support for multiple prompts and multiple answers for platform-specific command modules without any code change in the module (doc might be required to be updated)

    transform = ComplexList(dict(
        command=dict(key=True),
        prompt=dict(type='list'),
        answer=dict(type='list'),
        sendonly=dict(type='bool', default=False),
        check_all=dict(type='bool', default=False),
    ), module)
    commands = transform(module.params['commands'])

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this could probably be centralized. The thing I'm not sure about is that only some of the modules want output as a key and I'm not sure if including that will introduce problems.

It seems like it shouldn't be a problem; I don't think it should create unnecessary keys, but I'll have to look into it.

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Sep 6, 2018
@mattclay
Copy link
Member

mattclay commented Sep 6, 2018

CI failure in unit tests: https://app.shippable.com/github/ansible/ansible/runs/82624/4/tests

The network integration tests are also failing with a traceback:

https://app.shippable.com/github/ansible/ansible/runs/82624/29/console

@mattclay mattclay added the ci_verified Changes made in this PR are causing tests to fail. label Sep 6, 2018
@ansibot ansibot added test This PR relates to tests. and removed ci_verified Changes made in this PR are causing tests to fail. labels Sep 10, 2018
@mattclay
Copy link
Member

CI failure in integration tests: https://app.shippable.com/github/ansible/ansible/runs/83629/29/console

@mattclay mattclay added the ci_verified Changes made in this PR are causing tests to fail. label Sep 12, 2018
Also include iosxr in the fun
@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Sep 12, 2018
@ansibot
Copy link
Contributor

ansibot commented Sep 12, 2018

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

lib/ansible/modules/network/iosxr/iosxr_command.py:173:29: undefined-variable Undefined variable 'to_text'

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Sep 12, 2018
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Sep 12, 2018
@Qalthos Qalthos merged commit 285b927 into ansible:devel Sep 13, 2018
@Qalthos Qalthos deleted the command-cleanup branch September 13, 2018 12:55
@dagwieers dagwieers added iosxr Cisco IOSXR community cisco Cisco technologies labels Feb 22, 2019
@dagwieers dagwieers added the ios Cisco IOS community label Mar 5, 2019
@ansible ansible locked and limited conversation to collaborators Jul 22, 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 bug This issue/PR relates to a bug. cisco Cisco technologies core_review In order to be merged, this PR must follow the core review workflow. ios Cisco IOS community iosxr Cisco IOSXR community module This issue/PR relates to a module. networking Network category nxos Cisco NXOS community support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. support:network This issue/PR relates to code supported by the Ansible Network Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants