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

New modules and updated HTTP API plugin for FTD devices #44578

Merged
merged 10 commits into from
Aug 29, 2018
Merged

New modules and updated HTTP API plugin for FTD devices #44578

merged 10 commits into from
Aug 29, 2018

Conversation

annikulin
Copy link
Contributor

SUMMARY
  1. Adds ftd_configuration module that manages configuration on FTD devices;
  2. Adds ftd_file_upload module that provides functionality to upload files to FTD devices;
  3. Adds ftd_file_download module that provides functionality to download files from FTD devices;
ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME
  • httpapi
  • ftd_configuration
  • ftd_file_upload
  • ftd_file_download
ANSIBLE VERSION
2.7

@ansibot
Copy link
Contributor

ansibot commented Aug 23, 2018

@ansibot
Copy link
Contributor

ansibot commented Aug 23, 2018

@annikulin this PR contains more than one new module.

Please submit only one new module per pull request. For a detailed explanation, please read the grouped modules documentation

click here for bot help

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 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 new_contributor This PR is the first contribution by a new community member. new_module This PR includes a new module. new_plugin This PR includes a new plugin. 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. test This PR relates to tests. labels Aug 23, 2018
@ansibot
Copy link
Contributor

ansibot commented Aug 23, 2018

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with 1 error:

lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with 1 error:

lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with 1 error:

lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with 1 error:

lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with 1 error:

lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: missing documentation (or could not parse documentation): 'description'

The test ansible-test sanity --test boilerplate [explain] failed with 6 errors:

lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: missing: from __future__ import (absolute_import, division, print_function)
lib/ansible/modules/network/ftd/ftd_file_download.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/network/ftd/ftd_file_download.py:0:0: missing: from __future__ import (absolute_import, division, print_function)
lib/ansible/modules/network/ftd/ftd_file_upload.py:0:0: missing: __metaclass__ = type
lib/ansible/modules/network/ftd/ftd_file_upload.py:0:0: missing: from __future__ import (absolute_import, division, print_function)

The test ansible-test sanity --test import --python 2.6 [explain] failed with 1 error:

lib/ansible/module_utils/network/ftd/configuration.py:5:0: ImportError: No module named plugins.httpapi.ftd

The test ansible-test sanity --test import --python 2.7 [explain] failed with 2 errors:

lib/ansible/module_utils/network/ftd/configuration.py:5:0: ImportError: No module named plugins.httpapi.ftd
lib/ansible/modules/network/ftd/ftd_configuration.py:72:0: ImportError: No module named plugins.httpapi.ftd

The test ansible-test sanity --test import --python 3.5 [explain] failed with 2 errors:

lib/ansible/module_utils/network/ftd/configuration.py:5:0: ImportError: No module named 'ansible.plugins'
lib/ansible/modules/network/ftd/ftd_configuration.py:72:0: ImportError: No module named 'ansible.plugins'

The test ansible-test sanity --test import --python 3.6 [explain] failed with 2 errors:

lib/ansible/module_utils/network/ftd/configuration.py:5:0: ModuleNotFoundError: No module named 'ansible.plugins'
lib/ansible/modules/network/ftd/ftd_configuration.py:72:0: ModuleNotFoundError: No module named 'ansible.plugins'

The test ansible-test sanity --test import --python 3.7 [explain] failed with 2 errors:

lib/ansible/module_utils/network/ftd/configuration.py:5:0: ModuleNotFoundError: No module named 'ansible.plugins'
lib/ansible/modules/network/ftd/ftd_configuration.py:72:0: ModuleNotFoundError: No module named 'ansible.plugins'

The test ansible-test sanity --test no-underscore-variable [explain] failed with 3 errors:

lib/ansible/plugins/httpapi/ftd.py:71:9: use `dummy` instead of `_` for a variable name
lib/ansible/plugins/httpapi/ftd.py:133:13: use `dummy` instead of `_` for a variable name
test/units/plugins/httpapi/test_ftd.py:163:9: use `dummy` instead of `_` for a variable name

The test ansible-test sanity --test pep8 [explain] failed with 18 errors:

lib/ansible/modules/network/ftd/ftd_configuration.py:21:62: W291 trailing whitespace
lib/ansible/modules/network/ftd/ftd_file_download.py:16:96: W291 trailing whitespace
lib/ansible/modules/network/ftd/ftd_file_download.py:23:46: W291 trailing whitespace
lib/ansible/modules/network/ftd/ftd_file_download.py:32:125: W291 trailing whitespace
lib/ansible/modules/network/ftd/ftd_file_upload.py:22:46: W291 trailing whitespace
test/units/module_utils/network/ftd/test_configuration.py:43:20: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_configuration.py:46:16: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_parser.py:53:22: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:436:20: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:437:16: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:448:20: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:449:16: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:528:20: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:529:16: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:860:20: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:861:16: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:873:20: E126 continuation line over-indented for hanging indent
test/units/module_utils/network/ftd/test_fdm_swagger_validator.py:874:16: E126 continuation line over-indented for hanging indent

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

lib/ansible/modules/network/ftd/ftd_configuration.py:0:0: E305 DOCUMENTATION.description: required key not provided @ data['description']. Got None

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Aug 23, 2018
return False
self.login(self.connection.get_option('remote_user'), self.connection.get_option('password'))
retry_request = True
return retry_request
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be converted to return True. No need of new variable retry_request

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, done.

# plugin
self.refresh_token = False
self.access_token = False
display.vvvv("logged out successfully")
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure why logout is removed ? Don't we want to revoke token once connection is terminated ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

logout method still there. It was just moved closer to the login method.

display.vvvv("logged out successfully")
@staticmethod
def _get_api_token_path():
return os.environ.get(API_TOKEN_PATH_ENV_VAR, DEFAULT_API_TOKEN_PATH)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change these vars to ansible Host vars rather OS env vars.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Can you please help how to get Ansible host variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

@annikulin it needed more work than I initially thought to get httpapi plugin host var working. Probably we can commit this code as is and I will commit a followup PR to make it configurable using ansible host vars

@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Aug 24, 2018
return True


def equal_objects(d1, d2):
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might now work when there is dict of dict in response? It might break idempotency in those cases.
I think you need to call it recursively when there is dict of dict or dict of list of dict.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated.

@ansibot ansibot removed the ci_verified Changes made in this PR are causing tests to fail. label Aug 27, 2018
@@ -0,0 +1,159 @@
import re
Copy link

Choose a reason for hiding this comment

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

Please add copyright in all the files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, added.

@ansibot
Copy link
Contributor

ansibot commented Aug 29, 2018

@annikulin this PR contains the following merge commits:

Please rebase your branch to remove these commits.

click here for bot help

@ansibot ansibot added merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Aug 29, 2018
@ansibot ansibot removed merge_commit This PR contains at least one merge commit. Please resolve! needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Aug 29, 2018
@rcarrillocruz rcarrillocruz merged commit 40a97d4 into ansible:devel Aug 29, 2018
@dagwieers dagwieers added the cisco Cisco technologies label Mar 4, 2019
@dagwieers dagwieers added the ftd Cisco FTD community label Mar 19, 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.7 This issue/PR affects Ansible v2.7 cisco Cisco technologies ftd Cisco FTD community 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. networking Network category new_contributor This PR is the first contribution by a new community member. new_module This PR includes a new module. new_plugin This PR includes a new plugin. 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. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants