Created
November 20, 2011 19:09
-
-
Save vhata/1380719 to your computer and use it in GitHub Desktop.
On the fly method-caller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
m = imp.load_source(f,'%s/%s/deploy/%s.py' % (workspace_path, self.application.name, f)) | |
log.debug("Successfully imported module") | |
except IOError: | |
log.error("Could not find %s's deploy script" % self.application.name) | |
raise Exception('Could not import %s/%s/deploy/%s.py' % (workspace_path, self.application.name, f)) | |
try: | |
func = getattr(m,f) | |
except: | |
log.error("Failed to call function %s" % f) | |
raise | |
# call the function, passing in the configuration | |
log.debug('Changing cwd to workspace') | |
os.chdir('%s/%s' % (workspace_path, self.application.name)) | |
r = func(self.configuration) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment