예제 #1
0
파일: cli.py 프로젝트: GunioRobot/cobbler
def report_item(remote,otype,item=None,name=None):
   if item is None:
      item = remote.get_item(otype, name)
   if otype == "distro":
      data = utils.printable_from_fields(item, item_distro.FIELDS)
   elif otype == "profile":
      data = utils.printable_from_fields(item, item_profile.FIELDS)
   elif otype == "system":
      data = utils.printable_from_fields(item, item_system.FIELDS)
   elif otype == "repo":
      data = utils.printable_from_fields(item, item_repo.FIELDS)
   elif otype == "image":
      data = utils.printable_from_fields(item, item_image.FIELDS)
   print data
예제 #2
0
def report_item(remote,otype,item=None,name=None):
   if item is None:
      if otype == "setting":
          cur_settings = remote.get_settings()
          try:
              item = {'name':name, 'value':cur_settings[name]}
          except:
              print "Setting not found: %s" % name
              sys.exit(1)
      else:
          item = remote.get_item(otype, name)
          if item == "~":
              print "No %s found: %s" % (otype, name)
              sys.exit(1)

   if otype == "distro":
      data = utils.printable_from_fields(item, item_distro.FIELDS)
   elif otype == "profile":
      data = utils.printable_from_fields(item, item_profile.FIELDS)
   elif otype == "system":
      data = utils.printable_from_fields(item, item_system.FIELDS)
   elif otype == "repo":
      data = utils.printable_from_fields(item, item_repo.FIELDS)
   elif otype == "image":
      data = utils.printable_from_fields(item, item_image.FIELDS)
   elif otype == "mgmtclass":
      data = utils.printable_from_fields(item,item_mgmtclass.FIELDS)
   elif otype == "package":
      data = utils.printable_from_fields(item,item_package.FIELDS)
   elif otype == "file":
      data = utils.printable_from_fields(item,item_file.FIELDS)
   elif otype == "setting":
      data = "%-40s: %s" % (item['name'],item['value'])
   print data
예제 #3
0
def report_item(remote, otype, item=None, name=None):
    if item is None:
        if otype == "setting":
            cur_settings = remote.get_settings()
            try:
                item = {'name': name, 'value': cur_settings[name]}
            except:
                print "Setting not found: %s" % name
                sys.exit(1)
        elif otype == "signature":
            items = remote.get_signatures()
            total_sigs = 0
            if items.has_key("breeds"):
                print "Currently loaded signatures:"
                if items["breeds"].has_key(name):
                    print "%s:" % name
                    oskeys = items["breeds"][name].keys()
                    oskeys.sort()
                    if len(oskeys) > 0:
                        total_sigs += len(oskeys)
                        for osversion in oskeys:
                            print "\t%s" % osversion
                    else:
                        print "\t(none)"
                    print "\nBreed '%s' has %d total signatures" % (name,
                                                                    total_sigs)
                else:
                    print "No breed named '%s' found" % name
                    sys.exit(1)
            else:
                print "No breeds found in the signature, a signature update is recommended"
                sys.exit(1)
            return
        else:
            item = remote.get_item(otype, name)
            if item == "~":
                print "No %s found: %s" % (otype, name)
                sys.exit(1)

    if otype == "distro":
        data = utils.printable_from_fields(item, item_distro.FIELDS)
    elif otype == "profile":
        data = utils.printable_from_fields(item, item_profile.FIELDS)
    elif otype == "system":
        data = utils.printable_from_fields(item, item_system.FIELDS)
    elif otype == "repo":
        data = utils.printable_from_fields(item, item_repo.FIELDS)
    elif otype == "image":
        data = utils.printable_from_fields(item, item_image.FIELDS)
    elif otype == "mgmtclass":
        data = utils.printable_from_fields(item, item_mgmtclass.FIELDS)
    elif otype == "package":
        data = utils.printable_from_fields(item, item_package.FIELDS)
    elif otype == "file":
        data = utils.printable_from_fields(item, item_file.FIELDS)
    elif otype == "setting":
        data = "%-40s: %s" % (item['name'], item['value'])
    print data
예제 #4
0
파일: cli.py 프로젝트: HeidCloud/cobbler
def report_item(remote,otype,item=None,name=None):
   if item is None:
      if otype == "setting":
          cur_settings = remote.get_settings()
          try:
              item = {'name':name, 'value':cur_settings[name]}
          except:
              print "Setting not found: %s" % name
              sys.exit(1)
      elif otype == "signature":
          items = remote.get_signatures()
          total_sigs = 0
          if items.has_key("breeds"):
              print "Currently loaded signatures:"
              if items["breeds"].has_key(name):
                  print "%s:" % name
                  oskeys = items["breeds"][name].keys()
                  oskeys.sort()
                  if len(oskeys) > 0:
                      total_sigs += len(oskeys)
                      for osversion in oskeys:
                          print "\t%s" % osversion
                  else:
                      print "\t(none)"
                  print "\nBreed '%s' has %d total signatures" % (name,total_sigs)
              else:
                  print "No breed named '%s' found" % name
                  sys.exit(1)
          else:
              print "No breeds found in the signature, a signature update is recommended"
              sys.exit(1)
          return
      else:
          item = remote.get_item(otype, name)
          if item == "~":
              print "No %s found: %s" % (otype, name)
              sys.exit(1)

   if otype == "distro":
      data = utils.printable_from_fields(item, item_distro.FIELDS)
   elif otype == "profile":
      data = utils.printable_from_fields(item, item_profile.FIELDS)
   elif otype == "system":
      data = utils.printable_from_fields(item, item_system.FIELDS)
   elif otype == "repo":
      data = utils.printable_from_fields(item, item_repo.FIELDS)
   elif otype == "image":
      data = utils.printable_from_fields(item, item_image.FIELDS)
   elif otype == "mgmtclass":
      data = utils.printable_from_fields(item,item_mgmtclass.FIELDS)
   elif otype == "package":
      data = utils.printable_from_fields(item,item_package.FIELDS)
   elif otype == "file":
      data = utils.printable_from_fields(item,item_file.FIELDS)
   elif otype == "setting":
      data = "%-40s: %s" % (item['name'],item['value'])
   print data
예제 #5
0
def report_item(remote, otype, item=None, name=None):
    if item is None:
        item = remote.get_item(otype, name)
        if item == "~":
            print "No %s found: %s" % (otype, name)
            sys.exit(1)
    if otype == "distro":
        data = utils.printable_from_fields(item, item_distro.FIELDS)
    elif otype == "profile":
        data = utils.printable_from_fields(item, item_profile.FIELDS)
    elif otype == "system":
        data = utils.printable_from_fields(item, item_system.FIELDS)
    elif otype == "repo":
        data = utils.printable_from_fields(item, item_repo.FIELDS)
    elif otype == "image":
        data = utils.printable_from_fields(item, item_image.FIELDS)
    print data
예제 #6
0
파일: cli.py 프로젝트: saillinux/cobbler
def report_item(remote,otype,item=None,name=None):
   if item is None:
      item = remote.get_item(otype, name)
      if item == "~":
          print "No %s found: %s" % (otype, name)
          sys.exit(1)
   if otype == "distro":
      data = utils.printable_from_fields(item, item_distro.FIELDS)
   elif otype == "profile":
      data = utils.printable_from_fields(item, item_profile.FIELDS)
   elif otype == "system":
      data = utils.printable_from_fields(item, item_system.FIELDS)
   elif otype == "repo":
      data = utils.printable_from_fields(item, item_repo.FIELDS)
   elif otype == "image":
      data = utils.printable_from_fields(item, item_image.FIELDS)
   elif otype == "mgmtclass":
      data = utils.printable_from_fields(item,item_mgmtclass.FIELDS)
   elif otype == "package":
      data = utils.printable_from_fields(item,item_package.FIELDS)
   elif otype == "file":
      data = utils.printable_from_fields(item,item_file.FIELDS)
   print data
예제 #7
0
파일: item.py 프로젝트: GunioRobot/cobbler
 def printable(self):
     return utils.printable_from_fields(self,self.get_fields())
예제 #8
0
파일: item.py 프로젝트: aronparsons/cobbler
 def printable(self):
     return utils.printable_from_fields(self, self.get_fields())