diff --git a/robottelo/hosts.py b/robottelo/hosts.py index ef04881b5e5..2971cdcd79a 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -1956,7 +1956,7 @@ def delete_puppet_class(self, puppetclass_name): for hostgroup in puppet_class.read().hostgroup: hostgroup.delete_puppetclass(data={'puppetclass_id': puppet_class.id}) # Search and remove puppet class from affected hosts - for host in self.api.Host().search(query={'search': f'class={puppet_class.name}'}): + for host in self.api.Host(puppetclass=f'{puppet_class.name}').search(): host.delete_puppetclass(data={'puppetclass_id': puppet_class.id}) # Remove puppet class entity puppet_class.delete()