Skip to content

Commit

Permalink
more flexible template refresh - based on the metadata, not on an the
Browse files Browse the repository at this point in the history
system configuration (which may have changed)
  • Loading branch information
Mark Fiers committed Oct 24, 2012
1 parent c1cb27e commit 73cef9b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions moa/template/provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,20 @@ def refreshTemplate(self, wd, meta):
provided
"""
l.debug("refreshing template in %s" % self.__class__.__name__)

#base operation is to not thing, but just reinstall
provider = self.findProvider(meta.name, meta.provider)
provider.refresh(wd, meta)
pass
l.debug("refreshing template in %s" % self.__class__.__name__)
# instead of finding the old provider - instantiate a new
# copy of the class stated in `meta`

#import the correct module
mod = 'moa.template.provider.%s' % meta['class']
try:
pMod = __import__(mod, globals(), locals(), [mod], -1)
except ImportError:
moa.ui.exitError("cannot import provider %s" % meta['class'])

cob = getattr(pMod, meta['class'].capitalize())(meta['provider'], meta)
cob.refresh(wd, meta)

def installTemplate(self, wd, tName, pName=None):

Expand Down

0 comments on commit 73cef9b

Please sign in to comment.