当前位置: 首页>>代码示例>>Python>>正文


Python IObject.get_string方法代码示例

本文整理汇总了Python中boto.mashups.iobject.IObject.get_string方法的典型用法代码示例。如果您正苦于以下问题:Python IObject.get_string方法的具体用法?Python IObject.get_string怎么用?Python IObject.get_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boto.mashups.iobject.IObject的用法示例。


在下文中一共展示了IObject.get_string方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_image

# 需要导入模块: from boto.mashups.iobject import IObject [as 别名]
# 或者: from boto.mashups.iobject.IObject import get_string [as 别名]
 def create_image(self, bucket=None, prefix=None, key_file=None, cert_file=None, size=None):
     iobject = IObject()
     if not bucket:
         bucket = iobject.get_string('Name of S3 bucket')
     if not prefix:
         prefix = iobject.get_string('Prefix for AMI file')
     if not key_file:
         key_file = iobject.get_filename('Path to RSA private key file')
     if not cert_file:
         cert_file = iobject.get_filename('Path to RSA public cert file')
     if not size:
         size = iobject.get_int('Size (in MB) of bundled image')
     self.bundle_image(prefix, key_file, cert_file, size)
     self.upload_bundle(bucket, prefix)
     print 'registering image...'
     self.image_id = self.ec2.register_image('%s/%s.manifest.xml' % (bucket, prefix))
     return self.image_id
开发者ID:Biggytv,项目名称:titanium_build,代码行数:19,代码来源:server.py

示例2: bundle

# 需要导入模块: from boto.mashups.iobject import IObject [as 别名]
# 或者: from boto.mashups.iobject.IObject import get_string [as 别名]
 def bundle(self, bucket=None, prefix=None, key_file=None, cert_file=None,
            size=None, ssh_key=None, fp=None, clear_history=True):
     iobject = IObject()
     if not bucket:
         bucket = iobject.get_string('Name of S3 bucket')
     if not prefix:
         prefix = iobject.get_string('Prefix for AMI file')
     if not key_file:
         key_file = iobject.get_filename('Path to RSA private key file')
     if not cert_file:
         cert_file = iobject.get_filename('Path to RSA public cert file')
     if not size:
         size = iobject.get_int('Size (in MB) of bundled image')
     if not ssh_key:
         ssh_key = self.server.get_ssh_key_file()
     self.copy_x509(key_file, cert_file)
     if not fp:
         fp = StringIO.StringIO()
     fp.write('sudo mv %s /mnt/boto.cfg; ' % BotoConfigPath)
     fp.write('mv ~/.ssh/authorized_keys /mnt/authorized_keys; ')
     if clear_history:
         fp.write('history -c; ')
     fp.write(self.bundle_image(prefix, size, ssh_key))
     fp.write('; ')
     fp.write(self.upload_bundle(bucket, prefix, ssh_key))
     fp.write('; ')
     fp.write('sudo mv /mnt/boto.cfg %s; ' % BotoConfigPath)
     fp.write('mv /mnt/authorized_keys ~/.ssh/authorized_keys')
     command = fp.getvalue()
     print 'running the following command on the remote server:'
     print command
     t = self.ssh_client.run(command)
     print '\t%s' % t[0]
     print '\t%s' % t[1]
     print '...complete!'
     print 'registering image...'
     self.image_id = self.server.ec2.register_image(name=prefix, image_location='%s/%s.manifest.xml' % (bucket, prefix))
     return self.image_id
开发者ID:AlexanderNapierski,项目名称:boto,代码行数:40,代码来源:server.py


注:本文中的boto.mashups.iobject.IObject.get_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。