xlid 发表于 2018-7-30 11:05:36

ansible&Tower无限hosts的License修改方法

def validation_info(self, show_key = True):  
      if not self.fetch_ami() or not self.fetch_instance():
  
            return dict(valid_key=False, compliant=False)
  
      key = self.generate_key()
  
      if 'license_key' not in self.attributes:
  
            self.set_key(key)
  
      read_key = self.attributes.get('license_key', 'UNLICENSED')
  
      self.attributes['license_key'] = read_key
  
      if key != read_key:
  
            return dict(valid_key=False, compliant=False)
  
      if Host:
  
            current_instances = Host.objects.active_count()
  
      else:
  
            current_instances = 0
  
      available_instances = int(self.attributes['instance_count'])#修改这里
  
      self.attributes['current_instances'] = int(current_instances)
  
      self.attributes['available_instances'] = int(available_instances)
  
      self.attributes['free_instances'] = available_instances - current_instances
  
      self.attributes['valid_key'] = True
  
      self.attributes['license_date'] = sys.maxint
  
      self.attributes['time_remaining'] = sys.maxint
  
      self.attributes['grace_period_remaining'] = sys.maxint
  
      self.attributes['date_warning'] = False
  
      self.attributes['date_expired'] = False
  
      self.attributes['is_aws'] = True
页: [1]
查看完整版本: ansible&Tower无限hosts的License修改方法