コード例 #1
0
ファイル: configurevmware.py プロジェクト: sosilent/euca
 def get_current_value(self, prop_name):
     """
     Reads the current value from the system and stores it to
     a temp file.  Returns the path to the temp file.
     """
     value = ''
     obj = DescribeProperties()
     data = obj.main()
     props = getattr(data, 'euca:properties')
     for prop in props:
         if prop['euca:name'] == prop_name:
             value = prop['euca:value']
             if value == VMwareConfigDefault:
                 value = ''
     print '---Current value is:'
     print value
     return value
コード例 #2
0
ファイル: configurevmware.py プロジェクト: wyklq/eucalyptus
 def get_current_value(self, prop_name):
     """
     Reads the current value from the system and stores it to
     a temp file.  Returns the path to the temp file.
     """
     value = ''
     obj = DescribeProperties()
     data = obj.main()
     props = getattr(data, 'euca:properties')
     for prop in props:
         if prop['euca:name'] == prop_name:
             value = prop['euca:value']
             if value == VMwareConfigDefault:
                 value = ''
     if self.verbose_flg:
         print '---Current value is:'
         print value
     return value
コード例 #3
0
 def get_prop_name(self, part):
     num_found = 0
     name_found = None
     obj = DescribeProperties()
     data = obj.main()
     props = getattr(data, 'euca:properties')
     for prop in props:
         pname = prop['euca:name']
         if (part and pname == (part + VMwareConfigPropSuffix)) or (not part and pname.endswith(VMwareConfigPropSuffix)):
             name_found = pname
             num_found += 1
     if num_found < 1:
         if part:
             print 'Failed to find partition %s.' % part
         else:
             print 'Failed to find any partitions: is VMwareBroker registered?'
         sys.exit(1)
     elif num_found > 1:
         print 'Multiple partitions detected. Please, use the --partition option.'
         sys.exit(1)
     return name_found
コード例 #4
0
 def get_prop_name(self, part):
     num_found = 0
     name_found = None
     obj = DescribeProperties()
     data = obj.main()
     props = getattr(data, 'euca:properties')
     for prop in props:
         pname = prop['euca:name']
         if (part and pname == (part + VMwareConfigPropSuffix)) or (
                 not part and pname.endswith(VMwareConfigPropSuffix)):
             name_found = pname
             num_found += 1
     if num_found < 1:
         if part:
             print 'Failed to find partition %s.' % part
         else:
             print 'Failed to find any partitions: is VMwareBroker registered?'
         sys.exit(1)
     elif num_found > 1:
         print 'Multiple partitions detected. Please, use the --partition option.'
         sys.exit(1)
     return name_found