def device_get_by_hostname(self, context, hostname): init_node = db.init_node_get_by_hostname(context, hostname) if init_node: service_id = init_node['service_id'] device_list = db.device_get_by_service_id(context, service_id) if device_list: return device_list else: return None