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

Prevent exception for Non value #7270

Conversation

john-westcott-iv
Copy link
Member

SUMMARY

Fixes #7267

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • Collection
AWX VERSION
awx: 11.2.0
ADDITIONAL INFORMATION
This can be tested with the following task:
- name: Handle an omit value
  tower_settings:
    name: AWX_PROOT_BASE_PATH
    value: '{{ junk_var | default(omit) }}'

Without the change you get the stack.
With the new change it now long stacks but will return something like:

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unable to update settings, see response", "response": {"json": {"AWX_PROOT_BASE_PATH": ["This field may not be null."]}, "status_code": 400}}

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.

@awxbot awxbot added the type:bug label Jun 5, 2020
@AlanCoding AlanCoding added the component:awx_collection issues related to the collection for controlling AWX label Jun 7, 2020
@@ -82,6 +82,10 @@


def coerce_type(module, value):
# If our value is already None we can just return directly
if value == None:
Copy link
Member

Choose a reason for hiding this comment

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

if value is None.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

Copy link
Member

@AlanCoding AlanCoding left a comment

Choose a reason for hiding this comment

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

double checking tests for merge now

@AlanCoding
Copy link
Member

this is producing an integration test failure in tower_settings

  PLAY [testhost] ****************************************************************
  
  TASK [Gathering Facts] *********************************************************
  ok: [testhost]
  
  TASK [tower_settings : Set the value of AWX_PROOT_SHOW_PATHS to a baseline] ****
  changed: [testhost]
  
  TASK [tower_settings : Set the value of AWX_PROOT_SHOW_PATHS to get an error back from Tower] ***
  fatal: [testhost]: FAILED! => {"changed": false, "msg": "Unable to update settings, see response", "response": {"json": {"AWX_PROOT_SHOW_PATHS": ["Expected a list of items but got type \"OrderedDict\"."]}, "status_code": 400}}
  ...ignoring
  
  TASK [tower_settings : assert] *************************************************
  ok: [testhost] => {
      "changed": false, 
      "msg": "All assertions passed"
  }
  
  TASK [tower_settings : Set the value of AWX_PROOT_SHOW_PATHS] ******************
  changed: [testhost]
  
  TASK [tower_settings : assert] *************************************************
  ok: [testhost] => {
      "changed": false, 
      "msg": "All assertions passed"
  }
  
  TASK [tower_settings : Attempt to set the value of AWX_PROOT_BASE_PATH to what it already is] ***
  ok: [testhost]
  
  TASK [tower_settings : debug] **************************************************
  ok: [testhost] => {
      "msg": {
          "changed": false, 
          "failed": false, 
          "old_values": {}, 
          "warnings": [
              "You are using the awx version of this collection but connecting to Red Hat Ansible Tower"
          ]
      }
  }
  
  TASK [tower_settings : assert] *************************************************
  ok: [testhost] => {
      "changed": false, 
      "msg": "All assertions passed"
  }
  
  TASK [tower_settings : Apply a single setting via settings] ********************
  changed: [testhost]
  
  TASK [tower_settings : assert] *************************************************
  ok: [testhost] => {
      "changed": false, 
      "msg": "All assertions passed"
  }
  
  TASK [tower_settings : Apply multiple setting via settings with no change] *****
  ok: [testhost]
  
  TASK [tower_settings : debug] **************************************************
  ok: [testhost] => {
      "msg": {
          "changed": false, 
          "failed": false, 
          "old_values": {}, 
          "warnings": [
              "You are using the awx version of this collection but connecting to Red Hat Ansible Tower"
          ]
      }
  }
  
  TASK [tower_settings : assert] *************************************************
  ok: [testhost] => {
      "changed": false, 
      "msg": "All assertions passed"
  }
  
  TASK [tower_settings : Apply multiple setting via settings with change] ********
  changed: [testhost]
  
  TASK [tower_settings : assert] *************************************************
  ok: [testhost] => {
      "changed": false, 
      "msg": "All assertions passed"
  }
  
  TASK [tower_settings : Handle an omit value] ***********************************
  fatal: [testhost]: FAILED! => {"changed": false, "msg": "Unable to update settings, see response", "response": {"json": {"AWX_PROOT_BASE_PATH": ["This field may not be null."]}, "status_code": 400}}
  
  PLAY RECAP *********************************************************************
  testhost                   : ok=16   changed=4    unreachable=0    failed=1    skipped=0    rescued=0    ignored=1 

falsy API types are a headache. I say that not knowing the exact issue at hand here. I can help reproduce locally if needed.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

@beeankha beeankha self-requested a review June 8, 2020 14:08
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit e5ec761 into ansible:devel Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:awx_collection issues related to the collection for controlling AWX type:bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tower settings fails with stacktrace - expected to exit gracefully
4 participants