Home | History | Annotate | Download | only in server

Lines Matching full:host

19 def host_in_lab(host):
20 """Check if the host is in the lab and an object the AFE knows.
22 This check ensures that autoserv and the host's current job is running
24 case it then verifies the host is registed with the configured AFE
27 @param host: Host object to verify.
29 @returns The host model object.
31 if not host.job or not host.job.in_lab:
33 return AFE.get_hosts(hostname=host.hostname)
36 def get_build(host):
37 """Retrieve the current build for a given host from the AFE.
39 Looks through a host's labels in the AFE to determine its build.
41 @param host: Host object to get build.
44 were multiple build labels assigned to the host.
46 if not host_in_lab(host):
48 return utils.get_build_from_afe(host.hostname, AFE)
51 def get_board(host):
52 """Retrieve the board for a given host from the AFE.
54 Contacts the AFE to retrieve the board for a given host.
56 @param host: Host object to get board.
60 if not host_in_lab(host):
62 return utils.get_board_from_afe(host.hostname, AFE)
65 def clear_version_labels(host):
66 """Clear version labels for a given host.
68 @param host: Host whose version labels to clear.
70 if not host_in_lab(host):
73 host_list = [host.hostname]
75 name__startswith=host.VERSION_PREFIX,
76 host__hostname=host.hostname)
82 def add_version_label(host, image_name):
83 """Add version labels to a host.
85 @param host: Host to add the version label for.
86 @param image_name: Name of the build version to add to the host.
88 if not host_in_lab(host):
90 label = '%s:%s' % (host.VERSION_PREFIX, image_name)
91 AFE.run('label_add_hosts', id=label, hosts=[host.hostname])
94 def machine_install_and_update_labels(host, *args, **dargs):
95 """Calls machine_install and updates the version labels on a host.
97 @param host: Host object to run machine_install on.
101 clear_version_labels(host)
102 image_name = host.machine_install(*args, **dargs)
103 add_version_label(host, image_name)