<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto"><code class="notranslate">tower_credential</code></p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/lmadsen/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Sep  5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/lmadsen/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Sep  5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="DEFAULT_HOST_LIST(/home/lmadsen/src/github/leifmadsen/awx-builder/ansible.cfg) = [u'/home/lmadsen/src/github/leifmadsen/awx-builder/inventory']
HOST_KEY_CHECKING(/home/lmadsen/src/github/leifmadsen/awx-builder/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/lmadsen/src/github/leifmadsen/awx-builder/ansible.cfg) = False"><pre class="notranslate"><code class="notranslate">DEFAULT_HOST_LIST(/home/lmadsen/src/github/leifmadsen/awx-builder/ansible.cfg) = [u'/home/lmadsen/src/github/leifmadsen/awx-builder/inventory']
HOST_KEY_CHECKING(/home/lmadsen/src/github/leifmadsen/awx-builder/ansible.cfg) = False
RETRY_FILES_ENABLED(/home/lmadsen/src/github/leifmadsen/awx-builder/ansible.cfg) = False
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Fedora 26</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Use of the <code class="notranslate">tower_credential</code> module fails to post to the API</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Run the following play against AWX and you'll be returned the following failure:</p>
<p dir="auto">Sample play</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    - name: Configure SCM Credential
      tower_credential:
        name: Git
        description: Git default credential
        organization: null
        kind: scm
        tower_verify_ssl: False"><pre class="notranslate"><code class="notranslate">    - name: Configure SCM Credential
      tower_credential:
        name: Git
        description: Git default credential
        organization: null
        kind: scm
        tower_verify_ssl: False
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">No failure.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="The full traceback is:
Traceback (most recent call last):
  File &quot;/tmp/ansible_GcQSWf/ansible_module_tower_credential.py&quot;, line 292, in &lt;module&gt;
    main()
  File &quot;/tmp/ansible_GcQSWf/ansible_module_tower_credential.py&quot;, line 277, in main
    result = credential.modify(**params)
  File &quot;/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py&quot;, line 961, in modify
    force_on_exists=True, **kwargs)
  File &quot;/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py&quot;, line 345, in write
    r = getattr(client, method.lower())(url, data=kwargs)
  File &quot;/home/lmadsen/.local/lib/python2.7/site-packages/requests/sessions.py&quot;, line 577, in patch
    return self.request('PATCH', url, data=data, **kwargs)
  File &quot;/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/api.py&quot;, line 235, in request
    kwargs.get('data', None), r.content.decode('utf8'))
tower_cli.exceptions.BadRequest: The Tower server claims it was sent a bad request.

PATCH http://awx.nfvpe.site/api/v1/credentials/6/
Params: None
Data: {&quot;authorize&quot;: false, &quot;state&quot;: &quot;present&quot;, &quot;description&quot;: &quot;Git default credential&quot;, &quot;kind&quot;: &quot;scm&quot;, &quot;name&quot;: &quot;Git&quot;, &quot;tower_verify_ssl&quot;: false}

Response: {&quot;detail&quot;:[&quot;'state' is not a valid field for Source Control&quot;]}

fatal: [127.0.0.1]: FAILED! =&gt; {
    &quot;changed&quot;: false, 
    &quot;failed&quot;: true, 
    &quot;module_stderr&quot;: &quot;Traceback (most recent call last):\n  File \&quot;/tmp/ansible_GcQSWf/ansible_module_tower_credential.py\&quot;, line 292, in &lt;module&gt;\n    main()\n  File \&quot;/tmp/ansible_GcQSWf/ansible_module_tower_credential.py\&quot;, line 277, in main\n    result = credential.modify(**params)\n  File \&quot;/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py\&quot;, line 961, in modify\n    force_on_exists=True, **kwargs)\n  File \&quot;/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py\&quot;, line 345, in write\n    r = getattr(client, method.lower())(url, data=kwargs)\n  File \&quot;/home/lmadsen/.local/lib/python2.7/site-packages/requests/sessions.py\&quot;, line 577, in patch\n    return self.request('PATCH', url, data=data, **kwargs)\n  File \&quot;/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/api.py\&quot;, line 235, in request\n    kwargs.get('data', None), r.content.decode('utf8'))\ntower_cli.exceptions.BadRequest: The Tower server claims it was sent a bad request.\n\nPATCH http://awx.nfvpe.site/api/v1/credentials/6/\nParams: None\nData: {\&quot;authorize\&quot;: false, \&quot;state\&quot;: \&quot;present\&quot;, \&quot;description\&quot;: \&quot;Git default credential\&quot;, \&quot;kind\&quot;: \&quot;scm\&quot;, \&quot;name\&quot;: \&quot;Git\&quot;, \&quot;tower_verify_ssl\&quot;: false}\n\nResponse: {\&quot;detail\&quot;:[\&quot;'state' is not a valid field for Source Control\&quot;]}\n&quot;, 
    &quot;module_stdout&quot;: &quot;&quot;, 
    &quot;msg&quot;: &quot;MODULE FAILURE&quot;, 
    &quot;rc&quot;: 0
}"><pre class="notranslate"><code class="notranslate">The full traceback is:
Traceback (most recent call last):
  File "/tmp/ansible_GcQSWf/ansible_module_tower_credential.py", line 292, in &lt;module&gt;
    main()
  File "/tmp/ansible_GcQSWf/ansible_module_tower_credential.py", line 277, in main
    result = credential.modify(**params)
  File "/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py", line 961, in modify
    force_on_exists=True, **kwargs)
  File "/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py", line 345, in write
    r = getattr(client, method.lower())(url, data=kwargs)
  File "/home/lmadsen/.local/lib/python2.7/site-packages/requests/sessions.py", line 577, in patch
    return self.request('PATCH', url, data=data, **kwargs)
  File "/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/api.py", line 235, in request
    kwargs.get('data', None), r.content.decode('utf8'))
tower_cli.exceptions.BadRequest: The Tower server claims it was sent a bad request.

PATCH http://awx.nfvpe.site/api/v1/credentials/6/
Params: None
Data: {"authorize": false, "state": "present", "description": "Git default credential", "kind": "scm", "name": "Git", "tower_verify_ssl": false}

Response: {"detail":["'state' is not a valid field for Source Control"]}

fatal: [127.0.0.1]: FAILED! =&gt; {
    "changed": false, 
    "failed": true, 
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_GcQSWf/ansible_module_tower_credential.py\", line 292, in &lt;module&gt;\n    main()\n  File \"/tmp/ansible_GcQSWf/ansible_module_tower_credential.py\", line 277, in main\n    result = credential.modify(**params)\n  File \"/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py\", line 961, in modify\n    force_on_exists=True, **kwargs)\n  File \"/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/models/base.py\", line 345, in write\n    r = getattr(client, method.lower())(url, data=kwargs)\n  File \"/home/lmadsen/.local/lib/python2.7/site-packages/requests/sessions.py\", line 577, in patch\n    return self.request('PATCH', url, data=data, **kwargs)\n  File \"/home/lmadsen/.local/lib/python2.7/site-packages/tower_cli/api.py\", line 235, in request\n    kwargs.get('data', None), r.content.decode('utf8'))\ntower_cli.exceptions.BadRequest: The Tower server claims it was sent a bad request.\n\nPATCH http://awx.nfvpe.site/api/v1/credentials/6/\nParams: None\nData: {\"authorize\": false, \"state\": \"present\", \"description\": \"Git default credential\", \"kind\": \"scm\", \"name\": \"Git\", \"tower_verify_ssl\": false}\n\nResponse: {\"detail\":[\"'state' is not a valid field for Source Control\"]}\n", 
    "module_stdout": "", 
    "msg": "MODULE FAILURE", 
    "rc": 0
}
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">tower_credential<br>
tower_*</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/notting/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Sep  5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/notting/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Sep  5 2017, 08:53:59) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ANSIBLE_SSH_PIPELINING(/etc/ansible/ansible.cfg) = True
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 30"><pre class="notranslate"><code class="notranslate">ANSIBLE_SSH_PIPELINING(/etc/ansible/ansible.cfg) = True
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
PERSISTENT_CONNECT_TIMEOUT(/etc/ansible/ansible.cfg) = 30
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Fedora 26</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">With tower_cli 3.2.0 installed, assorted Tower modules fail:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[notting@nostromo: ~]$ ansible -m tower_credential localhost -a &quot;kind=ssh username=wow password=wow name=frobozznicate organization=TGP&quot;
[WARNING]: Could not match supplied host pattern, ignoring: all

[WARNING]: provided hosts list is empty, only localhost is available

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: tower_cli.exceptions.BadRequest: Missing required fields: credential-type
localhost | FAILED! =&gt; {
   &quot;changed&quot;: false,
   &quot;failed&quot;: true,
   &quot;module_stderr&quot;: &quot;Traceback (most recent call last):\n  File \&quot;/tmp/ansible_imDa8H/ansible_module_tower_credential.py\&quot;, line 292, in &lt;module&gt;\n    main()\n  File \&quot;/tmp/ansible_imDa8H/ansible_module_tower_credential.py\&quot;, line 277, in main\n    result = credential.modify(**params)\n  File \&quot;/usr/lib/python2.7/site-packages/tower_cli/models/base.py\&quot;, line 659, in modify\n    return self.write(pk, create_on_missing=create_on_missing, force_on_exists=True, **kwargs)\n  File \&quot;/usr/lib/python2.7/site-packages/tower_cli/models/base.py\&quot;, line 357, in write\n    raise exc.BadRequest('Missing required fields: %s' % ', '.join(missing_fields).replace('_', '-'))\ntower_cli.exceptions.BadRequest: Missing required fields: credential-type\n&quot;,
   &quot;module_stdout&quot;: &quot;&quot;,
   &quot;msg&quot;: &quot;MODULE FAILURE&quot;,
   &quot;rc&quot;: 0
}"><pre class="notranslate"><code class="notranslate">[notting@nostromo: ~]$ ansible -m tower_credential localhost -a "kind=ssh username=wow password=wow name=frobozznicate organization=TGP"
[WARNING]: Could not match supplied host pattern, ignoring: all

[WARNING]: provided hosts list is empty, only localhost is available

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: tower_cli.exceptions.BadRequest: Missing required fields: credential-type
localhost | FAILED! =&gt; {
   "changed": false,
   "failed": true,
   "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_imDa8H/ansible_module_tower_credential.py\", line 292, in &lt;module&gt;\n    main()\n  File \"/tmp/ansible_imDa8H/ansible_module_tower_credential.py\", line 277, in main\n    result = credential.modify(**params)\n  File \"/usr/lib/python2.7/site-packages/tower_cli/models/base.py\", line 659, in modify\n    return self.write(pk, create_on_missing=create_on_missing, force_on_exists=True, **kwargs)\n  File \"/usr/lib/python2.7/site-packages/tower_cli/models/base.py\", line 357, in write\n    raise exc.BadRequest('Missing required fields: %s' % ', '.join(missing_fields).replace('_', '-'))\ntower_cli.exceptions.BadRequest: Missing required fields: credential-type\n",
   "module_stdout": "",
   "msg": "MODULE FAILURE",
   "rc": 0
}
</code></pre></div>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">see above</p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">works</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">attempts to use /api/v1 parameters from 3.1 and earlier with tower-cli 3.2's /api/v2 usage. Things go kablooie.</p>