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

WIP - Windows - Add common util for web requests #54759

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
3 participants
@jborean93
Copy link
Contributor

jborean93 commented Apr 3, 2019

SUMMARY

This is a POC branch to tease out what a common URL handler would look like for PowerShell. It tries to combine common elements like shared module arg spec, reduce code duplication for the somewhat convoluted WebRequest class in .NET and the ability to easily add common module options for URL based modules in the future.

Things I know that still need to be fixed/solved before this can move away from a WIP PR;

  • Fix validate-modules to load other PS and C# module utils so the module arg spec can be from a util. Currently it fails because we don't load them
  • Figure out how we want to document the shared values and when they were added. Right now it just omits the version_added component in the shared doc fragment because some options were present/added in some modules but not others
  • Whether Invoke-WithWebRequest is too complicated with it's use of a ScriptBlock
  • Add warnings to Get-AnsibleWebRequest for options that conflict with each other
  • Whether Register-AnsibleWebRequestParams is something we want to use. Unfortunately we cannot take advantage of splatting from $module.Params and this was the next best thing I could find that allowed the module to ignore options that were implemented inside.
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

win_get_url
win_uri

@ansibot

This comment has been minimized.

@ansibot

This comment has been minimized.

Copy link
Contributor

ansibot commented Apr 3, 2019

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

test/sanity/pslint/ignore.txt:76:1: A102 Remove since "lib/ansible/modules/windows/win_get_url.ps1" passes "PSUsePSCredentialType" test

The test ansible-test sanity --test validate-modules [explain] failed with 33 errors:

lib/ansible/modules/windows/win_get_url.ps1:0:0: E321 Exception attempting to import module for argument_spec introspection, 'A hash table can only be added to another hash table.
At line:29 char:1
+ $spec.options += $ansible_web_request_options
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : AddHashTableToNonHashTable
 
'
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (client_cert) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (client_cert_password) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (follow_redirects) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (force_basic_auth) should be '2.5'. Currently None
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (headers) should be '2.4'. Currently None
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (http_agent) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (maximum_redirection) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (proxy_password) should be '2.0'. Currently None
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (proxy_url) should be '2.0'. Currently None
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (proxy_use_default_credential) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (proxy_username) should be '2.0'. Currently None
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (timeout) should be '2.4'. Currently None
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (use_default_credential) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (use_proxy) should be '2.4'. Currently None
lib/ansible/modules/windows/win_get_url.py:0:0: E309 version_added for new option (validate_certs) should be '2.4'. Currently None
lib/ansible/modules/windows/win_uri.ps1:0:0: E321 Exception attempting to import module for argument_spec introspection, 'A hash table can only be added to another hash table.
At line:30 char:1
+ $spec.options += $ansible_web_request_options
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : AddHashTableToNonHashTable
 
'
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (client_cert) should be '2.4'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (client_cert_password) should be '2.5'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (follow_redirects) should be '2.4'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (force_basic_auth) should be '2.5'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (http_agent) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (maximum_redirection) should be '2.4'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (proxy_password) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (proxy_url) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (proxy_use_default_credential) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (proxy_username) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (timeout) should be '2.4'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (url_password) should be '2.4'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (url_username) should be '2.4'. Currently None
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (use_default_credential) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (use_proxy) should be '2.8'. Currently StrictVersion ('0.0')
lib/ansible/modules/windows/win_uri.py:0:0: E309 version_added for new option (validate_certs) should be '2.4'. Currently None

click here for bot help

@ansibot ansibot added the ci_verified label Apr 3, 2019

@bcoca bcoca removed the needs_triage label Apr 9, 2019

@ansibot ansibot added the stale_ci label Apr 17, 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.