summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2012-01-11 23:12:31 (GMT)
committerTim Bielawa <tbielawa@redhat.com>2012-01-11 23:12:31 (GMT)
commit458909dc1e68b0bfe2bf5e29bf1a9c683e386629 (patch)
tree287d21f8e27df2974655cc168422fc6ced20d162
parent13a4ab66bc8fca485a5ee74cbe37dc9702effb6a (diff)
downloadTaboot-458909dc1e68b0bfe2bf5e29bf1a9c683e386629.zip
Taboot-458909dc1e68b0bfe2bf5e29bf1a9c683e386629.tar.gz
Taboot-458909dc1e68b0bfe2bf5e29bf1a9c683e386629.tar.xz
Bring normality to Taboot exceptions. Also, put the rpm tasks under the RPMBase task.
-rw-r--r--taboot/errors.py35
-rw-r--r--taboot/scripts.py4
-rw-r--r--taboot/tabootScript.py25
-rw-r--r--taboot/tasks/rpm.py4
4 files changed, 34 insertions, 34 deletions
diff --git a/taboot/errors.py b/taboot/errors.py
index 540fec0..720e0b2 100644
--- a/taboot/errors.py
+++ b/taboot/errors.py
@@ -16,7 +16,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-class FuncException(Exception):
+class TabootException(Exception):
+ """
+ Base Taboot Exception
+ """
+ pass
+
+
+class FuncException(TabootException):
"""
Exception raised whenever a func request returns REMOTE_ERROR
"""
@@ -33,27 +40,21 @@ class FuncException(Exception):
return repr(self)
-class TabootException(Exception):
+class TabootTaskNotFoundException(TabootException):
"""
- Base Taboot Exception
+ Exception raised if a task can not be found during document
+ validation.
"""
- pass
-class TabootMissingKrbTkt(TabootException):
- """
- Exception raised when an action that requires a kerberos ticket
- can't find one ahead of time.
- """
+class TabootMalformedYAMLException(TabootException):
pass
-class TabootTaskNotFoundException(AttributeError):
- """
- Exception raised if a task can not be found during document
- validation.
- """
-
+class TabootConcurrencyException(TabootException):
+ def __init__(self, value):
+ self.value = value
-class TabootMalformedYAMLException(Exception):
- pass
+ def __str__(self):
+ return repr("Concurrency Set and Non-concurrent task: %s present"
+ % self.value)
diff --git a/taboot/scripts.py b/taboot/scripts.py
index 7375d1b..e8907ef 100644
--- a/taboot/scripts.py
+++ b/taboot/scripts.py
@@ -134,8 +134,9 @@ The problem is on line %s, column %s.
self.scripts.append(taboot_script)
try:
+ log_debug("Validating (partial) contents of %s...", infile)
taboot_script.validate_concurrency()
- except ConcurrencyException as e:
+ except TabootConcurrencyException as e:
msg = """%s
Please choose one of these options:
1) Use Concurrency and ignore %s
@@ -151,6 +152,7 @@ Please choose one of these options:
else:
log_info("Unexpected input. Aborting.")
sys.exit(1)
+ log_debug("%s passed (partial) concurrency validation", infile)
def print_scripts(self):
for script in self.scripts:
diff --git a/taboot/tabootScript.py b/taboot/tabootScript.py
index 0d32dd0..810a7c8 100644
--- a/taboot/tabootScript.py
+++ b/taboot/tabootScript.py
@@ -19,7 +19,7 @@
import func
import yaml
from runner import Runner
-from errors import TabootTaskNotFoundException
+from errors import TabootTaskNotFoundException, TabootConcurrencyException
from util import resolve_types, instantiator
from log import *
@@ -47,6 +47,7 @@ class TabootScript(YamlDoc):
- `yamlDoc` - Dictionary representing our Taboot Script
- `fileName` - YAML file the script in
- `edited` - If we gave :option:`-E` on the command line
+ - `config` - Run-time configuration parameters
"""
YamlDoc.__init__(self, yamlDoc)
self.config = config
@@ -65,18 +66,23 @@ class TabootScript(YamlDoc):
"""
# Still need to finish, need to get concurrency value if it
# exists, then iterate through to see if there are any
- # non-conurrent tasks in, if so raise a ConcurrencyException,
- # will have to catch in cli.py
+ # non-conurrent tasks in, if so raise a
+ # TabootConcurrencyException, will have to catch in cli.py
#
# XX: I'm thinking that we can offer the user the ability to
# edit the script to correct
+ log_debug("Concurrency validating %s...", self.fileName)
+ log_debug("Concurrency: %s", self.getConcurrency())
if self.getConcurrency() > 1:
tasks = self.getTaskTypes()
for task in tasks:
task = instantiator(task, 'taboot.tasks', host="*")
if not task.concurrentFriendly:
- raise ConcurrencyException(task)
+ log_debug("Concurrency exception while validating %s",
+ self.fileName)
+ raise TabootConcurrencyException(task)
+ log_debug("%s passed concurrency check.", self.fileName)
return True
@@ -131,7 +137,7 @@ class TabootScript(YamlDoc):
self.yamlDoc['concurrency'] = concurrency
try:
log_info("Attempting to set concurrency to: %s", concurrency)
- except ConcurrencyException as e:
+ except TabootConcurrencyException as e:
log_warn("Cannot set concurrency: %s. Falling back to 1.", e)
self.setConcurrency(1)
@@ -206,12 +212,3 @@ class TabootScript(YamlDoc):
for b in doc:
if 'concurrency' in b:
del b['concurrency']
-
-
-class ConcurrencyException(Exception):
- def __init__(self, value):
- self.value = value
-
- def __str__(self):
- return repr("Concurrency Set and Non-concurrent task: %s present"
- % self.value)
diff --git a/taboot/tasks/rpm.py b/taboot/tasks/rpm.py
index ed05d0d..b69ad76 100644
--- a/taboot/tasks/rpm.py
+++ b/taboot/tasks/rpm.py
@@ -27,7 +27,7 @@ class RPMBase(command.Run):
super(RPMBase, self).__init__(pcmd, **kwargs)
-class PreManifest(command.Run):
+class PreManifest(RPMBase):
"""
Gather list of installed RPMs. A later invocation of :class:`PostManifest`
is then used to output the RPMs changed during intermediate tasks.
@@ -50,7 +50,7 @@ class PreManifest(command.Run):
return result
-class PostManifest(command.Run):
+class PostManifest(RPMBase):
"""
Gather list of installed RPMs and compare against a previously
taken :class:`PreManifest`