mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
Remove ForeignKey relations involving CustomInventoryScript
Add migration to carry out corresponding schema change Add data migration to delete inventory sources which are the custom type Split migration into two files data migration touches same rows as schema migration
This commit is contained in:
@@ -821,7 +821,6 @@ class InventorySourceOptions(BaseModel):
|
||||
('openstack', _('OpenStack')),
|
||||
('rhv', _('Red Hat Virtualization')),
|
||||
('tower', _('Ansible Tower')),
|
||||
('custom', _('Custom Script')),
|
||||
]
|
||||
|
||||
# From the options of the Django management base command
|
||||
@@ -845,14 +844,6 @@ class InventorySourceOptions(BaseModel):
|
||||
blank=True,
|
||||
default='',
|
||||
)
|
||||
# TODO: migrate away
|
||||
source_script = models.ForeignKey(
|
||||
'CustomInventoryScript',
|
||||
null=True,
|
||||
default=None,
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
source_vars = models.TextField(
|
||||
blank=True,
|
||||
default='',
|
||||
@@ -1329,7 +1320,6 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions, JobNotificationMixin,
|
||||
class CustomInventoryScript(CommonModelNameNotUnique, ResourceMixin):
|
||||
class Meta:
|
||||
app_label = 'main'
|
||||
unique_together = [('name', 'organization')]
|
||||
ordering = ('name',)
|
||||
|
||||
script = prevent_search(
|
||||
@@ -1339,21 +1329,6 @@ class CustomInventoryScript(CommonModelNameNotUnique, ResourceMixin):
|
||||
help_text=_('Inventory script contents'),
|
||||
)
|
||||
)
|
||||
organization = models.ForeignKey(
|
||||
'Organization',
|
||||
related_name='custom_inventory_scripts',
|
||||
help_text=_('Organization owning this inventory script'),
|
||||
blank=False,
|
||||
null=True,
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
|
||||
admin_role = ImplicitRoleField(
|
||||
parent_role='organization.admin_role',
|
||||
)
|
||||
read_role = ImplicitRoleField(
|
||||
parent_role=['organization.auditor_role', 'organization.member_role', 'admin_role'],
|
||||
)
|
||||
|
||||
def get_absolute_url(self, request=None):
|
||||
return reverse('api:inventory_script_detail', kwargs={'pk': self.pk}, request=request)
|
||||
|
||||
Reference in New Issue
Block a user