def checkDeprecatorOptions(options, parser): MarketplaceUtil.checkEndpointOption(options) if not P12Certificate.checkOptions(options): parser.error('Missing credentials. Please provide %s' % P12Certificate.optionString) if not options.email: parser.error('Missing email address. Please provide email of endorser')
def parse(self): self.parser.usage = '''%prog [options] metadata-file''' self.parser.description = ''' Sign the given metadata description of a machine or disk image. The metadata-file argument is the file containing the metadata to sign. ''' P12Certificate.addOptions(self.parser) self.parser.add_option('--output', dest='outputManifestFile', help='signed metadata file (same as input; input moved to *.orig)', default=None) self.parser.add_option('--email', dest='email', help='email address if not in certificate', default='') self.options, self.args = self.parser.parse_args()
def checkOptions(self): if not self.args: self.parser.error('Missing metadata file') self.manifestFile = self.args[0] isFile = os.path.isfile(self.manifestFile) exists = os.path.exists(self.manifestFile) if not (exists and isFile): self.parser.error('Metadata file doesn\'t exist or is not a file') if not P12Certificate.checkOptions(self.options): self.parser.error('Missing credentials. Please provide %s' % P12Certificate.optionString)
def buildDeprecatorParser(parser): parser.usage = '''usage: %prog [options] image-id''' parser.description = ''' Create a new metadata entry for the given image that deprecates the image. The reason for the deprecation must be given. The image-id argument is the identifier of the image to deprecate. ''' MarketplaceUtil.addEndpointOption(parser) P12Certificate.addOptions(parser) parser.add_option('--email', dest='email', help='email address of endorser of metadata entry', default='') parser.add_option('--created', dest='created', help='date of metadata entry to be deprecated, latest entry will be deprecated if not provided', default='') parser.add_option('--reason', dest='reason', help='Comment to append to deprecation', default='This image has been deprecated', metavar='TEXT')