add new name to multiple modules

This commit is contained in:
sean-m-ssullivan
2021-11-22 12:53:27 -05:00
committed by sean-m-sullivan
parent 03ed6e9755
commit bb8efbcc82
17 changed files with 172 additions and 34 deletions

View File

@@ -26,6 +26,10 @@ options:
- Name to use for the project.
required: True
type: str
new_name:
description:
- Setting this option will change the existing name (looked up via the name field.
type: str
copy_from:
description:
- Name or id to copy the project from.
@@ -249,6 +253,7 @@ def main():
# Any additional arguments that are not fields of the item can be added here
argument_spec = dict(
name=dict(required=True),
new_name=dict(),
copy_from=dict(),
description=dict(),
scm_type=dict(choices=['manual', 'git', 'svn', 'insights'], default='manual'),
@@ -281,6 +286,7 @@ def main():
# Extract our parameters
name = module.params.get('name')
new_name = module.params.get("new_name")
copy_from = module.params.get('copy_from')
scm_type = module.params.get('scm_type')
if scm_type == "manual":
@@ -347,7 +353,7 @@ def main():
# Create the data that gets sent for create and update
project_fields = {
'name': module.get_item_name(project) if project else name,
'name': new_name if new_name else (module.get_item_name(project) if project else name),
'scm_type': scm_type,
'organization': org_id,
'scm_update_on_launch': scm_update_on_launch,