mirror of
https://github.com/ZwareBear/awx.git
synced 2026-05-17 06:58:36 -05:00
add a functional test for creating an EE, remove bum copy function because it's not needed, copy works from the base class
moved AWXKit pull additions to separate PR and made some changes that were causing linting errors in tests and add copy to show_capabilities for the ee serializer
This commit is contained in:
@@ -3,7 +3,6 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from awx.api.versioning import reverse
|
||||
from awx.main.models.base import CommonModel
|
||||
from awx.main.utils import copy_model_by_class, copy_m2m_relationships
|
||||
|
||||
|
||||
__all__ = ['ExecutionEnvironment']
|
||||
@@ -50,21 +49,5 @@ class ExecutionEnvironment(CommonModel):
|
||||
help_text=_('Pull image before running?'),
|
||||
)
|
||||
|
||||
def copy_execution_environment(self):
|
||||
'''
|
||||
Returns saved object, including related fields.
|
||||
Create a copy of this unified job template.
|
||||
'''
|
||||
execution_environment_class = self.__class__
|
||||
fields = (f.name for f in self.Meta.fields)
|
||||
execution_environment_copy = copy_model_by_class(self, execution_environment_class, fields, {})
|
||||
|
||||
time_now = now()
|
||||
execution_environment_copy.name = execution_environment_copy.name.split('@', 1)[0] + ' @ ' + time_now.strftime('%I:%M:%S %p')
|
||||
|
||||
execution_environment_copy.save()
|
||||
copy_m2m_relationships(self, execution_environment_copy, fields)
|
||||
return execution_environment_copy
|
||||
|
||||
def get_absolute_url(self, request=None):
|
||||
return reverse('api:execution_environment_detail', kwargs={'pk': self.pk}, request=request)
|
||||
|
||||
Reference in New Issue
Block a user