File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,9 +35,10 @@ def __init__(self, env_var):
3535
3636
3737class IRPlaybookFailedException (IRException ):
38- def __init__ (self , playbook ):
39- super (self .__class__ , self ).__init__ (
40- 'Playbook "%s" failed!' % playbook )
38+ def __init__ (self , playbook , message = "" ):
39+ msg = 'Playbook "%s" failed!' % playbook
40+ msg = msg + message if message else msg
41+ super (self .__class__ , self ).__init__ (msg )
4142
4243
4344class IRYAMLConstructorError (IRException ):
Original file line number Diff line number Diff line change @@ -136,9 +136,11 @@ def execute_ansible(playbook, args):
136136
137137 print ""
138138 if len (failed_hosts ) > 0 :
139- raise Exception (2 )
139+ raise exceptions .IRPlaybookFailedException (
140+ playbook , "Failed hosts: %s" % failed_hosts )
140141 if len (unreachable_hosts ) > 0 :
141- raise Exception (3 )
142+ raise exceptions .IRPlaybookFailedException (
143+ playbook , "Unreachable hosts: %s" % unreachable_hosts )
142144
143145
144146def ansible_wrapper (args ):
You can’t perform that action at this time.
0 commit comments