summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-03-02 21:26:54 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-07 17:23:03 +0000
commit790b2d1387a150b85612ad38a53bab788154e4bb (patch)
treed4d2820e945ec16ab07e680563475beb6b425cc9 /bitbake/lib
parent96535ba720b2e2afe27ff2454d5b6031624ab7ab (diff)
downloadpoky-790b2d1387a150b85612ad38a53bab788154e4bb.tar.gz
bitbake: toaster: raise NotImplementedError
Raised NotImplementedError instead of Exception to be able to catch it. This is a preparation for removing sshbecontroller module. It has to be done as code in bldcontrol/tests.py imports custom NotImplementedException from sshbecontroller. (Bitbake rev: c243ab6c83fe12d84777e4c3a18fd393827b9327) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/toaster/bldcontrol/bbcontroller.py10
-rw-r--r--bitbake/lib/toaster/bldcontrol/models.py8
-rw-r--r--bitbake/lib/toaster/bldcontrol/tests.py6
3 files changed, 13 insertions, 11 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/bbcontroller.py b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
index 1387bdaa7b..f228d37459 100644
--- a/bitbake/lib/toaster/bldcontrol/bbcontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
@@ -138,7 +138,7 @@ class BuildEnvironmentController(object):
138 After this method executes, self.be bbaddress/bbport MUST point to a running and free server, 138 After this method executes, self.be bbaddress/bbport MUST point to a running and free server,
139 and the bbstate MUST be updated to "started". 139 and the bbstate MUST be updated to "started".
140 """ 140 """
141 raise Exception("FIXME: Must override in order to actually start the BB server") 141 raise NotImplementedError("FIXME: Must override in order to actually start the BB server")
142 142
143 143
144 def setLayers(self, bitbake, ls): 144 def setLayers(self, bitbake, ls):
@@ -149,7 +149,7 @@ class BuildEnvironmentController(object):
149 149
150 a word of attention: by convention, the first layer for any build will be poky! 150 a word of attention: by convention, the first layer for any build will be poky!
151 """ 151 """
152 raise Exception("FIXME: Must override setLayers") 152 raise NotImplementedError("FIXME: Must override setLayers")
153 153
154 154
155 def getBBController(self): 155 def getBBController(self):
@@ -176,16 +176,16 @@ class BuildEnvironmentController(object):
176 up to the implementing BEC. The return MUST be a REST URL where a GET will actually return 176 up to the implementing BEC. The return MUST be a REST URL where a GET will actually return
177 the content of the artifact, e.g. for use as a "download link" in a web UI. 177 the content of the artifact, e.g. for use as a "download link" in a web UI.
178 """ 178 """
179 raise Exception("Must return the REST URL of the artifact") 179 raise NotImplementedError("Must return the REST URL of the artifact")
180 180
181 def release(self): 181 def release(self):
182 """ This stops the server and releases any resources. After this point, all resources 182 """ This stops the server and releases any resources. After this point, all resources
183 are un-available for further reference 183 are un-available for further reference
184 """ 184 """
185 raise Exception("Must override BE release") 185 raise NotImplementedError("Must override BE release")
186 186
187 def triggerBuild(self, bitbake, layers, variables, targets): 187 def triggerBuild(self, bitbake, layers, variables, targets):
188 raise Exception("Must override BE release") 188 raise NotImplementedError("Must override BE release")
189 189
190class ShellCmdException(Exception): 190class ShellCmdException(Exception):
191 pass 191 pass
diff --git a/bitbake/lib/toaster/bldcontrol/models.py b/bitbake/lib/toaster/bldcontrol/models.py
index a3a49ce472..bb613c68a2 100644
--- a/bitbake/lib/toaster/bldcontrol/models.py
+++ b/bitbake/lib/toaster/bldcontrol/models.py
@@ -42,13 +42,17 @@ class BuildEnvironment(models.Model):
42 def get_artifact(self, path): 42 def get_artifact(self, path):
43 if self.betype == BuildEnvironment.TYPE_LOCAL: 43 if self.betype == BuildEnvironment.TYPE_LOCAL:
44 return open(path, "r") 44 return open(path, "r")
45 raise Exception("FIXME: artifact download not implemented for build environment type %s" % self.get_betype_display()) 45 raise NotImplementedError("FIXME: artifact download not implemented "\
46 "for build environment type %s" % \
47 self.get_betype_display())
46 48
47 def has_artifact(self, path): 49 def has_artifact(self, path):
48 import os 50 import os
49 if self.betype == BuildEnvironment.TYPE_LOCAL: 51 if self.betype == BuildEnvironment.TYPE_LOCAL:
50 return os.path.exists(path) 52 return os.path.exists(path)
51 raise Exception("FIXME: has artifact not implemented for build environment type %s" % self.get_betype_display()) 53 raise NotImplementedError("FIXME: has artifact not implemented for "\
54 "build environment type %s" % \
55 self.get_betype_display())
52 56
53# a BuildRequest is a request that the scheduler will build using a BuildEnvironment 57# a BuildRequest is a request that the scheduler will build using a BuildEnvironment
54# the build request queue is the table itself, ordered by state 58# the build request queue is the table itself, ordered by state
diff --git a/bitbake/lib/toaster/bldcontrol/tests.py b/bitbake/lib/toaster/bldcontrol/tests.py
index 141b42acbc..e8089914b7 100644
--- a/bitbake/lib/toaster/bldcontrol/tests.py
+++ b/bitbake/lib/toaster/bldcontrol/tests.py
@@ -48,13 +48,12 @@ class BEControllerTests(object):
48 self.assertTrue(err == '', "bitbake server pid %s not stopped" % err) 48 self.assertTrue(err == '', "bitbake server pid %s not stopped" % err)
49 49
50 def test_serverStartAndStop(self): 50 def test_serverStartAndStop(self):
51 from bldcontrol.sshbecontroller import NotImplementedException
52 obe = self._getBuildEnvironment() 51 obe = self._getBuildEnvironment()
53 bc = self._getBEController(obe) 52 bc = self._getBEController(obe)
54 try: 53 try:
55 # setting layers, skip any layer info 54 # setting layers, skip any layer info
56 bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) 55 bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
57 except NotImplementedException, e: 56 except NotImplementedError:
58 print "Test skipped due to command not implemented yet" 57 print "Test skipped due to command not implemented yet"
59 return True 58 return True
60 # We are ok with the exception as we're handling the git already exists 59 # We are ok with the exception as we're handling the git already exists
@@ -74,14 +73,13 @@ class BEControllerTests(object):
74 self._serverForceStop(bc) 73 self._serverForceStop(bc)
75 74
76 def test_getBBController(self): 75 def test_getBBController(self):
77 from bldcontrol.sshbecontroller import NotImplementedException
78 obe = self._getBuildEnvironment() 76 obe = self._getBuildEnvironment()
79 bc = self._getBEController(obe) 77 bc = self._getBEController(obe)
80 layerSet = False 78 layerSet = False
81 try: 79 try:
82 # setting layers, skip any layer info 80 # setting layers, skip any layer info
83 layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS) 81 layerSet = bc.setLayers(BITBAKE_LAYER, POKY_LAYERS)
84 except NotImplementedException: 82 except NotImplementedError:
85 print "Test skipped due to command not implemented yet" 83 print "Test skipped due to command not implemented yet"
86 return True 84 return True
87 # We are ok with the exception as we're handling the git already exists 85 # We are ok with the exception as we're handling the git already exists