mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Merge pull request #12351 from AlexSCorey/5673-t-importExportSchedules
Adds import export to awx cli for schedules as a top level object
This commit is contained in:
commit
b44442c460
@ -26,18 +26,11 @@ EXPORTABLE_RESOURCES = [
|
||||
'workflow_job_templates',
|
||||
'execution_environments',
|
||||
'applications',
|
||||
'schedules',
|
||||
]
|
||||
|
||||
|
||||
EXPORTABLE_RELATIONS = [
|
||||
'Roles',
|
||||
'NotificationTemplates',
|
||||
'WorkflowJobTemplateNodes',
|
||||
'Credentials',
|
||||
'Hosts',
|
||||
'Groups',
|
||||
'ExecutionEnvironments',
|
||||
]
|
||||
EXPORTABLE_RELATIONS = ['Roles', 'NotificationTemplates', 'WorkflowJobTemplateNodes', 'Credentials', 'Hosts', 'Groups', 'ExecutionEnvironments', 'Schedules']
|
||||
|
||||
|
||||
# These are special-case related objects, where we want only in this
|
||||
@ -45,13 +38,9 @@ EXPORTABLE_RELATIONS = [
|
||||
DEPENDENT_EXPORT = [
|
||||
('JobTemplate', 'labels'),
|
||||
('JobTemplate', 'survey_spec'),
|
||||
('JobTemplate', 'schedules'),
|
||||
('WorkflowJobTemplate', 'labels'),
|
||||
('WorkflowJobTemplate', 'survey_spec'),
|
||||
('WorkflowJobTemplate', 'schedules'),
|
||||
('WorkflowJobTemplate', 'workflow_nodes'),
|
||||
('Project', 'schedules'),
|
||||
('InventorySource', 'schedules'),
|
||||
('Inventory', 'groups'),
|
||||
('Inventory', 'hosts'),
|
||||
('Inventory', 'labels'),
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from contextlib import suppress
|
||||
|
||||
from awxkit.api.pages import UnifiedJob
|
||||
from awxkit.api.pages import SystemJobTemplate
|
||||
from awxkit.api.mixins import HasCreate
|
||||
from awxkit.api.resources import resources
|
||||
from awxkit.config import config
|
||||
import awxkit.exceptions as exc
|
||||
@ -9,8 +10,8 @@ from . import page
|
||||
from . import base
|
||||
|
||||
|
||||
class Schedule(UnifiedJob):
|
||||
|
||||
class Schedule(HasCreate, base.Base):
|
||||
dependencies = [SystemJobTemplate]
|
||||
NATURAL_KEY = ('unified_job_template', 'name')
|
||||
|
||||
def silent_delete(self):
|
||||
|
||||
@ -5,6 +5,8 @@ from . import page
|
||||
|
||||
|
||||
class SystemJobTemplate(UnifiedJobTemplate, HasNotifications):
|
||||
NATURAL_KEY = ('name', 'organization')
|
||||
|
||||
def launch(self, payload={}):
|
||||
"""Launch the system_job_template using related->launch endpoint."""
|
||||
result = self.related.launch.post(payload)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user