Esempio n. 1
0
File: group.py Progetto: OpenCSI/lbe
 def create(self):
     print "In order to create a new group, we need some information."
     self.group = LBEGroup()
     self.group.name = "groups"
     self._setGroupName()
     print "---------------------------------------------------------"
     print "Enter the ID of the Object Template:"
     self._setObjectTemplate()
     print "---------------------------------------------------------"
     print "Enter the ID of script for the group:"
     self._setScript()
     print "---------------------------------------------------------"
     print "-                        \033[33mWARNING\033[0m                        -"
     print "---------------------------------------------------------"
     self.group.objectTemplate = self.objectTemplate
     self.group.script = self.script
     self.viewGroup()
     choice = raw_input("Do you want to create the new group? [Y/n]\033[0m")
     if choice == 'n':
         return False
     self.group.synced_at = django.utils.timezone.now()
     groupHelper = GroupInstanceHelper(self.group,
                                       LBEGroupInstance(self.group))
     groupHelper.createTemplate()
     self.group.save()
     print "\033[32mGroup Saved!\033[0m"
     return True