-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
Adding module enos_config and its UT files #33081
Conversation
The test
The test
|
Please review these for merging |
required: false | ||
default: line | ||
choices: ['line', 'block', 'config'] | ||
force: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove force:
as the message says match: none
is the correct way of doing this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
match=dict(default='line', choices=['line', 'strict', 'exact', 'none']), | ||
replace=dict(default='line', choices=['line', 'block', 'config']), | ||
|
||
# this argument is deprecated in favor of setting match: none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove force:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
|
||
ANSIBLE_METADATA = {'metadata_version': '1.1', | ||
'status': ['preview'], | ||
'supported_by': 'network'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be 'supported_by': 'community'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing it, Thanks
The test
|
The test
The test
|
Please merge this now |
required: false | ||
default: no | ||
choices: ['yes', 'no'] | ||
version_added: "2.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line.
As this is a new module the top-level version_added is the only one needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing Now
not changed or committed, this argument is ignored. | ||
required: false | ||
default: 'configured by enos_config' | ||
version_added: "2.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line.
As this is a new module the top-level version_added is the only one needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing Now
required: false | ||
default: false | ||
choices: [ "yes", "no" ] | ||
version_added: "2.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line.
As this is a new module the top-level version_added is the only one needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing now
mutually exclusive with I(lines). | ||
required: false | ||
default: null | ||
version_added: "2.5" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this line.
As this is a new module the top-level version_added is the only one needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing Now
EXAMPLES = """ | ||
- name: configure top level configuration | ||
enos_config: | ||
lines: hostname {{ inventory_hostname }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "lines: hostname {{ inventory_hostname }}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing
required: false | ||
default: 'configured by enos_config' | ||
version_added: "2.5" | ||
admin: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Is this the same as EOS & IOS's privilege mode?
-
Would a password ever be needed
-
In Ansible 2.5 we are moving to using the standard Ansible 'become
system to enter enable mode, though that requires
connection: network_cli`, which I don't believe you are currently using.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ENOS, to get into privilege mode, by default , u dont need a password. Soon after login using admin/admin u are in exec mode. To go to Privilege Mode u just have to type in enable. I have already made in the sample / test roles in my Github with connection: network_cli. But I am facing an issue in my module_util file enos.py that in load_config method its coming as exec mode (> prompt, not # prompt ) I am at the moment testing it with this code
def load_config(module, config):
try:
conn = get_connection(module)
conn.get('enable')
conn.edit_config(config)
except ConnectionError as exc:
module.fail_json(msg=to_text(exc))
May be this will change once I put become=true and become_method = enable.
But as of now its not working for me
Please merge this now |
SUMMARY
Creating the config module for enos from Lenovo.
ISSUE TYPE
New Module Pull Request
COMPONENT NAME
lib/ansible/modules/network/enos/enos_config.py
test/units/modules/network/enos/fixtures/enos_config_config.cfg
test/units/modules/network/enos/fixtures/enos_config_src.cfg
test/units/modules/network/enos/test_enos_config.py
ANSIBLE VERSION
ansible 2.5.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.5.0-py2.7.egg/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]
ADDITIONAL INFORMATION
This is an effort to create modules for enos based switches from Lenovo.