Move logic for job reboot before/after defaults from RPC method to job model. Also adding a reference to the host protections enum in the Host model as a convenience for some other code I'm working on.
Signed-off-by: Steve Howard <[email protected]> --- autotest/frontend/afe/models.py 2010-01-19 16:24:08.000000000 -0800 +++ autotest/frontend/afe/models.py 2010-01-19 16:24:08.000000000 -0800 @@ -201,6 +201,7 @@ Status = enum.Enum('Verifying', 'Running', 'Ready', 'Repairing', 'Repair Failed', 'Dead', 'Cleaning', 'Pending', string_values=True) + Protection = host_protections.Protection hostname = dbmodels.CharField(max_length=255, unique=True) labels = dbmodels.ManyToManyField(Label, blank=True, @@ -692,6 +693,13 @@ and filling in the rest of the necessary information. """ AclGroup.check_for_acl_violation_hosts(hosts) + + user = User.current_user() + if options.get('reboot_before') is None: + options['reboot_before'] = user.get_reboot_before_display() + if options.get('reboot_after') is None: + options['reboot_after'] = user.get_reboot_after_display() + job = cls.add_object( owner=owner, name=options['name'], --- autotest/frontend/afe/rpc_interface.py 2010-01-19 16:24:08.000000000 -0800 +++ autotest/frontend/afe/rpc_interface.py 2010-01-19 16:24:08.000000000 -0800 @@ -515,11 +515,6 @@ this_host = models.Host.create_one_time_host(host) host_objects.append(this_host) - if reboot_before is None: - reboot_before = user.get_reboot_before_display() - if reboot_after is None: - reboot_after = user.get_reboot_after_display() - options = dict(name=name, priority=priority, control_file=control_file, _______________________________________________ Autotest mailing list [email protected] http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
