Repository: ansible/ansible

Issue:
typo in junos_config.py breaks configuration rollbacks
<!---
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release, and master branch are affected too.
-->

##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
 - Bug Report

##### COMPONENT NAME
<!--- Name of the module/plugin/task/feature -->
junos_config.py

##### ANSIBLE VERSION
<!--- Paste verbatim output from “ansible --version” between quotes below -->
```
ansible 2.2.0.0
```

##### CONFIGURATION
<!---
Mention any settings you have changed/added/removed in ansible.cfg
(or using the ANSIBLE_* environment variables).
-->

##### OS / ENVIRONMENT
<!---
N/A
-->

##### SUMMARY
<!--- Explain the problem briefly -->
in /modules/network/junos/junos_config.py

missing "s" in module.params causes config rollbacks to fail

Line 290
    kwargs = dict(comment=module.param['comment'],
should be
    kwargs = dict(comment=module.params['comment'],
Sorry I am noob hope this is enough :)

##### STEPS TO REPRODUCE
<!----->
just trying to use rollbacks produces:

TASK [Rolling back config ... please wait] *************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NetworkModule' object has no attribute 'param'
fatal: [VMX]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 343, in <module>\n    main()\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 334, in main\n    run(module, result)\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 286, in run\n    return rollback_config(module, result)\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 266, in rollback_config\n    kwargs = dict(comment=module.param['comment'],\nAttributeError: 'NetworkModule' object has no attribute 'param'\n", "module_stdout": "", "msg": "MODULE FAILURE"}

when missing "s" is added, rollbacks work


<!--- Paste example playbooks or commands between quotes below -->
```yaml

```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->

##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes below -->
```

```

typo in junos_config.py breaks configuration rollbacks
<!---
Verify first that your issue/request is not already reported on GitHub.
Also test if the latest release, and master branch are affected too.
-->

##### ISSUE TYPE
<!--- Pick one below and delete the rest: -->
 - Bug Report

##### COMPONENT NAME
<!--- Name of the module/plugin/task/feature -->
junos_config.py

##### ANSIBLE VERSION
<!--- Paste verbatim output from “ansible --version” between quotes below -->
```
ansible 2.2.0.0
```

##### CONFIGURATION
<!---
Mention any settings you have changed/added/removed in ansible.cfg
(or using the ANSIBLE_* environment variables).
-->

##### OS / ENVIRONMENT
<!---
N/A
-->

##### SUMMARY
<!--- Explain the problem briefly -->
in /modules/network/junos/junos_config.py

missing "s" in module.params causes config rollbacks to fail

Line 290
    kwargs = dict(comment=module.param['comment'],
should be
    kwargs = dict(comment=module.params['comment'],
Sorry I am noob hope this is enough :)

##### STEPS TO REPRODUCE
<!----->
just trying to use rollbacks produces:

TASK [Rolling back config ... please wait] *************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'NetworkModule' object has no attribute 'param'
fatal: [VMX]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 343, in <module>\n    main()\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 334, in main\n    run(module, result)\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 286, in run\n    return rollback_config(module, result)\n  File \"/tmp/ansible_vwI7_Y/ansible_module_junos_config.py\", line 266, in rollback_config\n    kwargs = dict(comment=module.param['comment'],\nAttributeError: 'NetworkModule' object has no attribute 'param'\n", "module_stdout": "", "msg": "MODULE FAILURE"}

when missing "s" is added, rollbacks work


<!--- Paste example playbooks or commands between quotes below -->
```yaml

```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->

##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes below -->
```

```



Discussion:
cc @privateip, @gundalow, @Qalthos, @ganeshnalawade
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
cc @privateip, @gundalow, @Qalthos, @ganeshnalawade
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/network/junos/junos_config.py b/lib/ansible/modules/network/junos/junos_config.py
--- a/lib/ansible/modules/network/junos/junos_config.py
+++ b/lib/ansible/modules/network/junos/junos_config.py
@@ -287,7 +287,7 @@ def load_config(module, result):
 def rollback_config(module, result):
     rollback = module.params['rollback']
 
-    kwargs = dict(comment=module.param['comment'],
+    kwargs = dict(comment=module.params['comment'],
                   commit=not module.check_mode)
 
     diff = module.connection.rollback_config(rollback, **kwargs)


Test patch: