Add multiple assert export for awx cli

This commit is contained in:
Artsiom Musin
2022-11-08 15:11:56 +01:00
parent 192f45bbd0
commit 9b047c2af6
2 changed files with 18 additions and 12 deletions

View File

@@ -28,51 +28,51 @@ options:
default: 'False' default: 'False'
organizations: organizations:
description: description:
- organization name to export - organization names to export
type: str type: str
users: users:
description: description:
- user name to export - user names to export
type: str type: str
teams: teams:
description: description:
- team name to export - team names to export
type: str type: str
credential_types: credential_types:
description: description:
- credential type name to export - credential type names to export
type: str type: str
credentials: credentials:
description: description:
- credential name to export - credential names to export
type: str type: str
execution_environments: execution_environments:
description: description:
- execution environment name to export - execution environment names to export
type: str type: str
notification_templates: notification_templates:
description: description:
- notification template name to export - notification template names to export
type: str type: str
inventory_sources: inventory_sources:
description: description:
- inventory soruce to export - inventory soruces to export
type: str type: str
inventory: inventory:
description: description:
- inventory name to export - inventory names to export
type: str type: str
projects: projects:
description: description:
- project name to export - project names to export
type: str type: str
job_templates: job_templates:
description: description:
- job template name to export - job template names to export
type: str type: str
workflow_job_templates: workflow_job_templates:
description: description:
- workflow name to export - workflow names to export
type: str type: str
requirements: requirements:
- "awxkit >= 9.3.0" - "awxkit >= 9.3.0"
@@ -94,6 +94,10 @@ EXAMPLES = '''
export: export:
job_templates: "My Template" job_templates: "My Template"
credential: 'all' credential: 'all'
- name: Export two or more inventories with a comma separated list of names
export:
inventory: "My Inventory1,My Inventory2"
''' '''
import logging import logging

View File

@@ -218,6 +218,8 @@ class ApiV2(base.Base):
return endpoint.get(id=int(value)) return endpoint.get(id=int(value))
options = self._cache.get_options(endpoint) options = self._cache.get_options(endpoint)
identifier = next(field for field in options['search_fields'] if field in ('name', 'username', 'hostname')) identifier = next(field for field in options['search_fields'] if field in ('name', 'username', 'hostname'))
if len(value.split(',')) > 0:
identifier += '__in'
return endpoint.get(**{identifier: value}, all_pages=True) return endpoint.get(**{identifier: value}, all_pages=True)
def export_assets(self, **kwargs): def export_assets(self, **kwargs):