Make kind read-only for PUT/PATCH, use isinstance in Host Manager, update field fasly check

This commit is contained in:
Wayne Witzel III
2017-05-02 13:00:17 -04:00
parent bdb13ecd71
commit af35838aff
3 changed files with 15 additions and 5 deletions

View File

@@ -27,9 +27,8 @@ class HostManager(models.Manager):
set. Use the `host_filter` to generate the queryset for the hosts.
"""
qs = super(HostManager, self).get_queryset()
if hasattr(self, 'instance') and self.instance is not None:
if hasattr(self.instance, 'kind') and self.instance.kind == 'dynamic':
if hasattr(self.instance, 'host_filter') and self.instance.host_filter is not None:
if hasattr(self, 'instance') and isinstance(self.instance, models.Inventory):
if self.instance.kind == 'dynamic' and self.instance.host_filter is not None:
q = DynamicFilter.query_from_string(self.instance.host_filter)
# If we are using host_filters, disable the core_filters, this allows
# us to access all of the available Host entries, not just the ones associated