How to use on_host_membership_change method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...63 for host in hosts:64 host.aclgroup_set.add(user_acl)65 # and add to reservation acl66 user_acl.hosts.add(*hosts)67 user_acl.on_host_membership_change()68def release(hosts_to_release, username=None):69 """70 Release a collection of hosts from user71 It's OK if user does not own these systems, in which case this does nothing72 :param hosts_to_release: strings or idents for hosts to release73 :type hosts_to_release: list74 :param username: login of the user reserving hosts75 :type username: str76 """77 hosts = models.Host.smart_get_bulk(hosts_to_release)78 if not hosts:79 raise Exception("At least one host must be specified")80 user = get_user(username)81 acls = models.AclGroup.objects.filter(name=user.login)82 if acls:83 user_acl = acls[0]84 user_acl.hosts.remove(*hosts)85 user_acl.on_host_membership_change()86def force_release(hosts_to_release, username=None):87 """88 Force release a collection of hosts from user89 This will remove all ACLs from the hosts90 :param hosts_to_release: strings or idents for hosts to release91 :type hosts_to_release: list92 :param username: login of the user reserving hosts93 :type username: str94 """95 hosts = models.Host.smart_get_bulk(hosts_to_release)96 if not hosts:97 raise Exception("At least one host must be specified")98 user = get_user(username)99 if not user.is_superuser():100 raise Exception("Must be super user to force release")101 acls = models.AclGroup.objects.all()102 for user_acl in acls:103 user_acl.hosts.remove(*hosts)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?