Exemplo n.º 1
0
 def handleRecipe(self,
                  xmlrecipe,
                  user,
                  guest=False,
                  ignore_missing_tasks=False):
     if not guest:
         recipe = MachineRecipe(ttasks=0)
         for xmlguest in xmlrecipe.iter_guests():
             guestrecipe = self.handleRecipe(
                 xmlguest,
                 user,
                 guest=True,
                 ignore_missing_tasks=ignore_missing_tasks)
             recipe.guests.append(guestrecipe)
     else:
         recipe = GuestRecipe(ttasks=0)
         recipe.guestname = xmlrecipe.guestname
         recipe.guestargs = xmlrecipe.guestargs
     recipe.host_requires = xmlrecipe.hostRequires()
     recipe.distro_requires = xmlrecipe.distroRequires()
     recipe.partitions = xmlrecipe.partitions()
     try:
         recipe.distro_tree = DistroTree.by_filter(
             "%s" % recipe.distro_requires)[0]
     except IndexError:
         raise BX(
             _('No distro tree matches Recipe: %s') %
             recipe.distro_requires)
     try:
         # try evaluating the host_requires, to make sure it's valid
         systems = XmlHost.from_string(recipe.host_requires).apply_filter(
             System.query)
     except StandardError, e:
         raise BX(_('Error in hostRequires: %s' % e))
Exemplo n.º 2
0
 def handleRecipe(self, xmlrecipe, user, guest=False, ignore_missing_tasks=False):
     if not guest:
         recipe = MachineRecipe(ttasks=0)
         for xmlguest in xmlrecipe.iter_guests():
             guestrecipe = self.handleRecipe(xmlguest, user, guest=True,
                     ignore_missing_tasks=ignore_missing_tasks)
             recipe.guests.append(guestrecipe)
     else:
         recipe = GuestRecipe(ttasks=0)
         recipe.guestname = xmlrecipe.guestname
         recipe.guestargs = xmlrecipe.guestargs
     recipe.host_requires = xmlrecipe.hostRequires()
     recipe.distro_requires = xmlrecipe.distroRequires()
     recipe.partitions = xmlrecipe.partitions()
     try:
         recipe.distro_tree = DistroTree.by_filter("%s" %
                                        recipe.distro_requires)[0]
     except IndexError:
         raise BX(_('No distro tree matches Recipe: %s') % recipe.distro_requires)
     try:
         # try evaluating the host_requires, to make sure it's valid
         recipe.distro_tree.systems_filter(user, recipe.host_requires)
     except StandardError, e:
         raise BX(_('Error in hostRequires: %s' % e))