Merge "ansible_playbook: add support for DoNotSpecify inventory type"
This commit is contained in:
commit
441add1aad
@ -3953,6 +3953,7 @@ def ansible_playbook(parser, xml_parent, data):
|
||||
:inventory-type values:
|
||||
* **path**
|
||||
* **content**
|
||||
* **do-not-specify**
|
||||
|
||||
:arg dict inventory: Inventory data, depends on inventory-type
|
||||
|
||||
@ -4016,7 +4017,7 @@ def ansible_playbook(parser, xml_parent, data):
|
||||
except KeyError as ex:
|
||||
raise MissingAttributeError(ex)
|
||||
|
||||
inventory_types = ('path', 'content')
|
||||
inventory_types = ('path', 'content', 'do-not-specify')
|
||||
inventory_type = str(
|
||||
data.get('inventory-type', inventory_types[0])).lower()
|
||||
|
||||
@ -4040,6 +4041,9 @@ def ansible_playbook(parser, xml_parent, data):
|
||||
XML.SubElement(inventory, 'content').text = content
|
||||
XML.SubElement(inventory, 'dynamic').text = str(
|
||||
inv_data.get('dynamic', False)).lower()
|
||||
elif inventory_type == 'do-not-specify':
|
||||
inventory.set(
|
||||
'class', 'org.jenkinsci.plugins.ansible.InventoryDoNotSpecify')
|
||||
else:
|
||||
raise InvalidAttributeError(
|
||||
'inventory-type', inventory_type, inventory_types)
|
||||
|
21
tests/builders/fixtures/ansible-playbook003.xml
Normal file
21
tests/builders/fixtures/ansible-playbook003.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<builders>
|
||||
<org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder>
|
||||
<playbook>path/to/playbook.yml</playbook>
|
||||
<inventory class="org.jenkinsci.plugins.ansible.InventoryDoNotSpecify"/>
|
||||
<limit/>
|
||||
<tags/>
|
||||
<skippedTags/>
|
||||
<startAtTask/>
|
||||
<credentialsId/>
|
||||
<sudo>false</sudo>
|
||||
<forks>5</forks>
|
||||
<unbufferedOutput>true</unbufferedOutput>
|
||||
<colorizedOutput>false</colorizedOutput>
|
||||
<hostKeyChecking>false</hostKeyChecking>
|
||||
<additionalParameters/>
|
||||
<copyCredentialsInWorkspace>false</copyCredentialsInWorkspace>
|
||||
</org.jenkinsci.plugins.ansible.AnsiblePlaybookBuilder>
|
||||
</builders>
|
||||
</project>
|
5
tests/builders/fixtures/ansible-playbook003.yaml
Normal file
5
tests/builders/fixtures/ansible-playbook003.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
builders:
|
||||
- ansible-playbook:
|
||||
playbook: "path/to/playbook.yml"
|
||||
inventory-type: "do-not-specify"
|
Loading…
x
Reference in New Issue
Block a user