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

fix bugs for ce #54750

Merged
merged 21 commits into from Apr 17, 2019

Conversation

Projects
None yet
5 participants
@xuxiaowei0512
Copy link
Contributor

commented Apr 3, 2019

SUMMARY

ansible 2.8.0.dev0

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/module_utils/network/cloudengine/ce.py
lib/ansible/modules/network/cloudengine/ce_aaa_server.py
lib/ansible/modules/network/cloudengine/ce_aaa_server_host.py
lib/ansible/modules/network/cloudengine/ce_command.py
lib/ansible/modules/network/cloudengine/ce_facts.py
lib/ansible/modules/network/cloudengine/ce_netconf.py
lib/ansible/modules/network/cloudengine/ce_vlan.py
lib/ansible/plugins/action/ce.py

ADDITIONAL INFORMATION

Before modify
task path: /usr/huawei/zhangyan/test_playbook/test_ce_command.yml:298
<10.130.200.118> connection transport is cli
<10.130.200.118> using connection plugin network_cli (was local)
<10.130.200.118> starting connection from persistent connection plugin
<10.130.200.118> found existing local domain socket, using it!
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> updating play_context for connection
<10.130.200.118>
<10.130.200.118> local domain socket path is /root/.ansible/pc/298903fe61
<10.130.200.118> socket_path: /root/.ansible/pc/298903fe61
<10.130.200.118> wrong context, sending exit to device
The full traceback is:
Traceback (most recent call last):
File "/usr/local/python3.5/lib/python3.5/site-packages/ansible-2.8.0.dev0-py3.5.egg/ansible/executor/task_executor.py", line 144, in run
res = self._execute()
File "/usr/local/python3.5/lib/python3.5/site-packages/ansible-2.8.0.dev0-py3.5.egg/ansible/executor/task_executor.py", line 645, in _execute
result = self._handler.run(task_vars=variables)
File "/usr/local/python3.5/lib/python3.5/site-packages/ansible-2.8.0.dev0-py3.5.egg/ansible/plugins/action/ce.py", line 93, in run
conn.send_command('exit')
File "/usr/local/python3.5/lib/python3.5/site-packages/ansible-2.8.0.dev0-py3.5.egg/ansible/module_utils/connection.py", line 186, in rpc
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
ansible.module_utils.connection.ConnectionError: exit
^
Error: Unrecognized command found at '^' position.
[~6865_130.52-25GE1/0/1]

fatal: [10.130.200.118]: FAILED! => {
"msg": "Unexpected failure during module execution.",
"stdout": ""
}
...ignoring
META: ran handlers
META: ran handlers

After

ask path: /usr/huawei/zhangyan/test_playbook/test_ce_command.yml:286
<10.130.200.118> connection transport is cli
<10.130.200.118> using connection plugin network_cli (was local)
<10.130.200.118> starting connection from persistent connection plugin
<10.130.200.118> found existing local domain socket, using it!
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> updating play_context for connection
<10.130.200.118>
<10.130.200.118> local domain socket path is /root/.ansible/pc/437536b3fa
<10.130.200.118> socket_path: /root/.ansible/pc/437536b3fa
<10.130.200.118> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.130.200.118> EXEC /bin/sh -c 'echo ~root && sleep 0'
<10.130.200.118> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1554256256.9274127-79058881795127 `" && echo ansible-tmp-1554256256.9274127-79058881795127="` echo /root/.ansible/tmp/ansible-tmp-1554256256.9274127-79058881795127 `" ) && sleep 0'
Using module file /usr/local/python3.5/lib/python3.5/site-packages/ansible-2.8.0.dev0-py3.5.egg/ansible/modules/network/cloudengine/ce_command.py
<10.130.200.118> PUT /root/.ansible/tmp/ansible-local-126491tkpxyr1n/tmpn0pyfwsr TO /root/.ansible/tmp/ansible-tmp-1554256256.9274127-79058881795127/AnsiballZ_ce_command.py
<10.130.200.118> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1554256256.9274127-79058881795127/ /root/.ansible/tmp/ansible-tmp-1554256256.9274127-79058881795127/AnsiballZ_ce_command.py && sleep 0'
<10.130.200.118> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1554256256.9274127-79058881795127/AnsiballZ_ce_command.py && sleep 0'
<10.130.200.118> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1554256256.9274127-79058881795127/ > /dev/null 2>&1 && sleep 0'
ok: [10.130.200.118] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "commands": [
                "system-view",
                "interface  25GE1/0/1",
                "description qqqq",
                "description qqqq",
                "commit"
            ],
            "host": "10.130.200.118",
            "interval": 1,
            "match": "all",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 10066,
            "provider": {
                "host": "10.130.200.118",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": 10066,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": null,
                "username": "huawei",
                "validate_certs": null
            },
            "retries": 10,
            "ssh_keyfile": null,
            "timeout": null,
            "transport": "cli",
            "use_ssl": null,
            "username": "huawei",
            "validate_certs": null,
            "wait_for": null
        }
    },
    "stdout": [
        "Enter system view, return user view with return command.",
        "",
        "",
        "",
        ""
    ],
    "stdout_lines": [
        [
            "Enter system view, return user view with return command."
        ],
        [
            ""
        ],
        [
            ""
        ],
        [
            ""
        ],
        [
            ""
        ]
    ]
}

TASK [Step6.7 Cover the unsupported device delivery interface test] **********************************************************
task path: /usr/huawei/zhangyan/test_playbook/test_ce_command.yml:298
<10.130.200.118> connection transport is cli
<10.130.200.118> using connection plugin network_cli (was local)
<10.130.200.118> starting connection from persistent connection plugin
<10.130.200.118> found existing local domain socket, using it!
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> Response received, triggered 'persistent_buffer_read_timeout' timer of 0.1 seconds
<10.130.200.118> updating play_context for connection
<10.130.200.118>
<10.130.200.118> local domain socket path is /root/.ansible/pc/437536b3fa
<10.130.200.118> socket_path: /root/.ansible/pc/437536b3fa
<10.130.200.118> wrong context, sending exit to device
<10.130.200.118> ESTABLISH LOCAL CONNECTION FOR USER: root
<10.130.200.118> EXEC /bin/sh -c 'echo ~root && sleep 0'
<10.130.200.118> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1554256259.4460437-219076050383854 `" && echo ansible-tmp-1554256259.4460437-219076050383854="` echo /root/.ansible/tmp/ansible-tmp-1554256259.4460437-219076050383854 `" ) && sleep 0'
Using module file /usr/local/python3.5/lib/python3.5/site-packages/ansible-2.8.0.dev0-py3.5.egg/ansible/modules/network/cloudengine/ce_command.py
<10.130.200.118> PUT /root/.ansible/tmp/ansible-local-126491tkpxyr1n/tmpkjuahqqa TO /root/.ansible/tmp/ansible-tmp-1554256259.4460437-219076050383854/AnsiballZ_ce_command.py
<10.130.200.118> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1554256259.4460437-219076050383854/ /root/.ansible/tmp/ansible-tmp-1554256259.4460437-219076050383854/AnsiballZ_ce_command.py && sleep 0'
<10.130.200.118> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1554256259.4460437-219076050383854/AnsiballZ_ce_command.py && sleep 0'
<10.130.200.118> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1554256259.4460437-219076050383854/ > /dev/null 2>&1 && sleep 0'
ok: [10.130.200.118] => {
    "changed": false,
    "invocation": {
        "module_args": {
            "commands": [
                "system-view",
                "interface  25GE1/0/2",
                "description qqqq",
                "commit"
            ],
            "host": "10.130.200.118",
            "interval": 1,
            "match": "all",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 10066,
            "provider": {
                "host": "10.130.200.118",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": 10066,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": null,
                "username": "huawei",
                "validate_certs": null
            },
            "retries": 10,
            "ssh_keyfile": null,
            "timeout": null,
            "transport": "cli",
            "use_ssl": null,
            "username": "huawei",
            "validate_certs": null,
            "wait_for": null
        }
    },
    "stdout": [
        "Enter system view, return user view with return command.",
        "",
        "",
        ""
    ],
    "stdout_lines": [
        [
            "Enter system view, return user view with return command."
        ],
        [
            ""
        ],
        [
            ""
        ],
        [
            ""
        ]
    ]
}
META: ran handlers
META: ran handlers


xuxiaowei0512 added some commits Mar 31, 2019

Update ce.py
            while to_text(out, errors='surrogate_then_replace').strip().endswith(']'):
                display.vvvv('wrong context, sending exit to device', self._play_context.remote_addr)
                conn.exec_command('return')
                out = conn.get_prompt()

connetion has no send_command function and ce device has no 'exit' command to return user-view(a correct context),but 'return' .command.
Add files via upload
Some bugs fix.
Add files via upload
fix some bugs
fix a bug for ce_command
Running a command with prompt via ce_command, It doesn't work.The reason is that the key word for network_cli recognition is answer not response.
fix bugs
fix bugs for ce modules
Delete ce_ftp.py
need modify
@xuxiaowei0512

This comment has been minimized.

Copy link
Contributor Author

commented on b089d45 Apr 3, 2019

connetion has no send_command function and ce device has no 'exit' command to return user-view(a correct context),but 'return' .command.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

@XuCodeSir, just so you are aware we have a dedicated Working Group for network.
You can find other people interested in this in #ansible-network on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

xuxiaowei0512 added some commits Apr 3, 2019

Compatible with Python 3
Compatible with Python 3 and fix bugs for ce
Add files via upload
modify doc
Add files via upload
Compatible with Python 3 and fix bugs
Add files via upload
Compatible with Python 3 and fix bugs
Add files via upload
Cancellation of change
Update ce_netconf.py
It is a bug that response has no xml attribute:line 183
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 3, 2019

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

lib/ansible/modules/network/cloudengine/ce_config.py:0:0: E323 Argument 'backup_options' is listed in DOCUMENTATION.options, but not accepted by the module argument_spec

click here for bot help

Add files via upload
Compatible with Python 3 and fix bugs
@xuxiaowei0512
Copy link
Contributor Author

left a comment

updatp ce_config.py
a bug for this module.
@xuxiaowei0512
Copy link
Contributor Author

left a comment

modiy to fix a bug for ce_config.py when config soure is a file or with multiple context.

@@ -240,10 +241,45 @@ def get_running_config(module):
return NetworkConfig(indent=1, contents=contents)


def conversion_src(module):

This comment has been minimized.

Copy link
@xuxiaowei0512

xuxiaowei0512 Apr 5, 2019

Author Contributor

There is a bug when commands is run and source config is a file.
It can not work corrctly.

@xuxiaowei0512

This comment has been minimized.

Copy link
Contributor Author

commented Apr 7, 2019

ready_for_review

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 11, 2019

Components

lib/ansible/module_utils/network/cloudengine/ce.py
support: community
maintainers: QijunPan

lib/ansible/modules/network/cloudengine/ce_aaa_server.py
support: community
maintainers: QijunPan

lib/ansible/modules/network/cloudengine/ce_aaa_server_host.py
support: community
maintainers: QijunPan

lib/ansible/modules/network/cloudengine/ce_command.py
support: community
maintainers: JackyGao2016 QijunPan

lib/ansible/modules/network/cloudengine/ce_config.py
support: community
maintainers: QijunPan

lib/ansible/modules/network/cloudengine/ce_facts.py
support: community
maintainers: QijunPan

lib/ansible/modules/network/cloudengine/ce_netconf.py
support: community
maintainers: QijunPan

lib/ansible/modules/network/cloudengine/ce_vlan.py
support: community
maintainers: QijunPan

lib/ansible/plugins/action/ce.py
support: community
maintainers:

Metadata

waiting_on: maintainer
changes_requested_by: null
needs_info: False
needs_revision: False
needs_rebase: False
merge_commits: []
too many files or commits: False
mergeable_state: clean
shippable_status: success
maintainer_shipits (module maintainers): 0
community_shipits (namespace maintainers): 0
ansible_shipits (core team members): 0
shipit_actors (maintainer or core team member): []
shipit_actors_other: []
automerge: automerge shipit test failed

click here for bot help

@justbiaoliu
Copy link
Contributor

left a comment

shipit

@ganeshrn ganeshrn merged commit 1017f15 into ansible:devel Apr 17, 2019

1 check passed

Shippable Run 117806 status is SUCCESS.
Details

ruimoreira added a commit to ruimoreira/ansible that referenced this pull request Apr 22, 2019

fix bugs for ce (ansible#54750)
* Update ce.py

            while to_text(out, errors='surrogate_then_replace').strip().endswith(']'):
                display.vvvv('wrong context, sending exit to device', self._play_context.remote_addr)
                conn.exec_command('return')
                out = conn.get_prompt()

connetion has no send_command function and ce device has no 'exit' command to return user-view(a correct context),but 'return' .command.

* Add files via upload

Some bugs fix.

* Add files via upload

fix some bugs

* fix a bug for ce_command

Running a command with prompt via ce_command, It doesn't work.The reason is that the key word for network_cli recognition is answer not response.

* fix bugs

fix bugs for ce modules

* Update ce.py

* Delete ce_ftp.py

need modify

* Delete ce_lacp.py

* Add files via upload

* Delete ce_aaa_server.py

* Delete ce_aaa_server_host.py

* Compatible with Python 3

Compatible with Python 3 and fix bugs for ce

* Update ce_aaa_server.py

* Add files via upload

modify doc

* Add files via upload

Compatible with Python 3 and fix bugs

* Add files via upload

Compatible with Python 3 and fix bugs

* Add files via upload

Cancellation of change

* Update ce_netconf.py

It is a bug that response has no xml attribute:line 183

* Add files via upload

* Add files via upload

Compatible with Python 3 and fix bugs

* updatp ce_config.py

a bug for this module.

@sivel sivel removed the needs_triage label Apr 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.