Skip to contentSkip to conversation

frontend.shared.rest_client: Fix reference to an undefined variable

PATCH New Lucas Meneghel Rodrigues 1 participant 4 messages May 6, 2011 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 frontend.shared.rest_client: Fix reference to an undefined variable

The author forgot to reference self, calling the method _http.request of the ResponseObject class.

---
 frontend/shared/rest_client.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
frontend/shared/rest_client.py +1 -1
index 9c4f5d5..7294e40 100644
@@ -143,7 +143,7 @@ class Resource(object):
             logging.debug('Response verification failed, clearing headers and '
                           'trying again:\n%s', response_body)
             _clear_request_headers(uri)
-            headers, response_body = _http.request(
+            headers, response_body = self._http.request(
                 full_uri, method, body=entity_body,
                 headers=_get_request_headers(uri))
 
Signature · 1 line
1.7.5
#1 lore raw

PATCH 2/4 frontend.afe.models: Fixing undefined variable error

---
 frontend/afe/models.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
frontend/afe/models.py +1 -1
index 33ffb8c..cfaa836 100644
@@ -561,7 +561,7 @@ class TestParameter(dbmodels.Model):
         unique_together = ('test', 'name')
 
     def __unicode__(self):
-        return u'%s (%s)' % (self.name, test.name)
+        return u'%s (%s)' % (self.name, self.test.name)
 
 
 class Profiler(dbmodels.Model, model_logic.ModelExtensions):
Signature · 1 line
1.7.5
#2 lore raw

PATCH 3/4 frontend.afe.resources: Fixing undefined variable error

In reply to Lucas Meneghel Rodrigues
---
 frontend/afe/resources.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
frontend/afe/resources.py +4 -3
index eaeeea0..b783115 100644
@@ -1,10 +1,11 @@
 from django import http
-from autotest_lib.frontend.shared import query_lib, resource_lib
+from autotest_lib.frontend.shared import query_lib, resource_lib, exceptions
 from autotest_lib.frontend.afe import control_file, models, rpc_utils
 from autotest_lib.frontend.afe import model_attributes
 from autotest_lib.frontend import thread_local
 from autotest_lib.client.common_lib import host_protections
 
+
 class EntryWithInvalid(resource_lib.InstanceEntry):
     def put(self):
         if self.instance.invalid:
@@ -319,7 +320,7 @@ class Host(EntryWithInvalid):
         if 'platform' in input_dict:
             label = self.resolve_link(input_dict['platform']) .instance
             if not label.platform:
-                raise BadRequest('Label %s is not a platform' % label.name)
+                raise exceptions.BadRequest('Label %s is not a platform' % label.name)
             for label in self.instance.labels.filter(platform=True):
                 self.instance.labels.remove(label)
             self.instance.labels.add(label)
@@ -779,7 +780,7 @@ class QueueEntry(resource_lib.InstanceEntry):
     def update(self, input_dict):
         if 'aborted' in input_dict:
             if input_dict['aborted'] != True:
-                raise BadRequest('"aborted" can only be set to true')
+                raise exceptions.BadRequest('"aborted" can only be set to true')
             query = models.HostQueueEntry.objects.filter(pk=self.instance.pk)
             models.AclGroup.check_abort_permissions(query)
             rpc_utils.check_abort_synchronous_jobs(query)
Signature · 1 line
1.7.5
#3 lore raw

PATCH 4/4 mirror.config-sample: Fixing undefined variable error

In reply to Lucas Meneghel Rodrigues
---
 client/profilers/ftrace/ftrace.py |    1 +
 mirror/config-sample.py           |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)
client/profilers/ftrace/ftrace.py +1 -0
index dd13fff..03c9d84 100644
@@ -5,6 +5,7 @@ Function tracer profiler for autotest.
 """
 import logging, os, signal, time
 from autotest_lib.client.bin import profiler, utils
+from autotest_lib.client.common_lib import error
 
 
 class ftrace(profiler.profiler):
mirror/config-sample.py +2 -2
index 29e215f..7788aa2 100644
@@ -88,5 +88,5 @@ _tests_map = {
 
 # now register some trigger actions otherwise nothing will be done for the new
 # kernel versions
-trigger.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s'))
-trigger.add_action(trigger_module.email_action('[email protected]'))
+trigger_module.trigger.add_action(trigger_module.map_action(_tests_map, 'kerntest-%s'))
+trigger_module.trigger.add_action(trigger_module.email_action('[email protected]'))
Signature · 1 line
1.7.5