# potential bug in eric\_eccli module,

**URL:** <https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045>\
**Category:** Ansible Developer\
**Created:** [August 15, 2019, 9:42am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045 "2019-08-15T09:42:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Moller](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lucas\_Moller](https://forum.ansible.com/u/Lucas_Moller)\
**Post date:** [August 15, 2019, 9:42am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/1 "2019-08-15T09:42:01Z")

</div>

Hi all,

I am currently developing and checking out the eric\_eccli module which has been merged to the devel build not long ago.  
I am using the newest Ansible devel build

I got now a failure of a task with, as it seems, a normal command:

- name: save configuration to flash memory  
eric\_eccli\_command:  
commands:
- save configuration

even with

- y

or wait\_for it fails due to command timeout.

From the terminal point of view it asks if the existing file should be overwritten.

On playbook execution, it fires the command waits until the timeout and fails.  
Other commands work just fine, to mention all other commands do not require user input for (y/n).

This is a crucial feature for automating the upgrade and configuration management of the devices  
Also the release download command for the device requests user input of (y/n)

Shell, command and raw modules do not solve the issue either.

Currently I see no way around this. Shall I report it as a bug on GitHub?  
Or am I missing something?

It seems like the module is not capable of reacting to user input actions like (y/n)

To note: It fails on different devices due to the same issue.

Feedback is appreciated.

//Lucas

---

<div class="post-metadata">

**Author:** ![ganeshrn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ganeshrn/32/1021_2.png) [@ganeshrn](https://forum.ansible.com/u/ganeshrn)\
**Post date:** [August 16, 2019, 6:09am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/2 "2019-08-16T06:09:31Z")

</div>

Try with below task. The prompt option is a regex value to match the expected terminal prompt after executing the command.

```auto
- name: save configuration to flash memory
  eric_eccli_command:
    commands:
      - command: save configuration
        prompt: <regex to match prompt on terminal after command execution>
        answer: 'y'

OR

- name: save configuration to flash memory
  cli_command:
    command: save configuration
    prompt: <regex to match prompt on terminal after command execution>

```

```auto
    answer: 'y'

```

```auto

```

```auto
[https://docs.ansible.com/ansible/latest/modules/cli_command_module.html](https://docs.ansible.com/ansible/latest/modules/cli_command_module.html)

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Lucas\_Moller](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lucas\_Moller](https://forum.ansible.com/u/Lucas_Moller)\
**Post date:** [August 16, 2019, 7:51am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/3 "2019-08-16T07:51:27Z")

</div>

Thank you for the information.  
eric\_eccli\_command has actually no option for prompts.cli\_command is then the way to go but there is another issue with that, which seems not to be related to the input in the playbook, but the output from the device:

“changed”: false,  
“invocation”: {  
“module\_args”: {  
“answer”: [  
“y”  
],  
“check\_all”: false,  
“command”: “save configuration”,  
“newline”: false,  
“prompt”: [  
“Target file exists, overwrite? (y/n)”  
],  
“sendonly”: false  
}  
},  
“msg”: “get() got an unexpected keyword argument ‘newline’”

It does not matter what I enter as prompt and answer.  
The actual response for the prompt from the device are two lines of output and in the second line the prompt has to be answered

Save to file: /flash/device\_config.cfg  
Target file exists, overwrite? (y/n)

Though what I understand is that the error is not from the playbook syntax but from the parsing of the response.  
Is there any option to avoid that error? Or to loop over the lines and answer on a match?

---

<div class="post-metadata">

**Author:** ![Lucas\_Moller](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lucas\_Moller](https://forum.ansible.com/u/Lucas_Moller)\
**Post date:** [August 16, 2019, 8:31am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/4 "2019-08-16T08:31:43Z")

</div>

Ok I have now checked the python code and commented the argument newline out (lib/ansible/modules/network/cli/cli\_command.py: Line 147).

It is seems to work now.

But there is then an issue with the newline parameter on the type of network devices.

If anybody does not have a better solution or any information I might still be missing, I will open a feature request for prompts in eric\_eccli and a bug report for cli\_command and the newline parameter.

Thank you

---

<div class="post-metadata">

**Author:** ![ganeshrn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ganeshrn/32/1021_2.png) [@ganeshrn](https://forum.ansible.com/u/ganeshrn)\
**Post date:** [August 16, 2019, 9:35am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/5 "2019-08-16T09:35:35Z")

</div>

Yes please raise a Github issue.  
Based on code eric\_eccli\_commnad module should support prompt when the value of “commands” option is list of dictionary. What is the error you see with eric\_eccli\_command module.

---

<div class="post-metadata">

**Author:** ![Lucas\_Moller](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lucas\_Moller](https://forum.ansible.com/u/Lucas_Moller)\
**Post date:** [August 16, 2019, 9:42am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/6 "2019-08-16T09:42:59Z")

</div>

Just that prompt, answer are noarguments of eric\_eccli, here is the output:

“changed”: false,  
“invocation”: {  
“module\_args”: {  
“answer”: [  
“y”  
],  
“commands”: “save configuration”,  
“prompt”: [  
“(y/n)”  
]  
}  
},  
“msg”: “Unsupported parameters for (eric\_eccli\_command) module: answer, prompt Supported parameters include: commands, interval, match, retries, wait\_for”

---

<div class="post-metadata">

**Author:** ![ganeshrn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ganeshrn/32/1021_2.png) [@ganeshrn](https://forum.ansible.com/u/ganeshrn)\
**Post date:** [August 16, 2019, 10:35am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/7 "2019-08-16T10:35:25Z")

</div>

The task input seems to be wrong. Value of “commands” should be dictionary. Check the earlier mail for expected task input

---

<div class="post-metadata">

**Author:** ![Lucas\_Moller](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@Lucas\_Moller](https://forum.ansible.com/u/Lucas_Moller)\
**Post date:** [August 16, 2019, 11:16am UTC](https://forum.ansible.com/t/potential-bug-in-eric-eccli-module/31045/8 "2019-08-16T11:16:15Z")

</div>

Oh you’re right, I have had a slightly different syntax.  
It is working now as you told me, we can close down the discussion.

Thank you for helping me out.

Best regards

Lucas
