original_docstring: Updates the attributes of a datastore version.
docstring: Updates the attributes of a datastore version.
docstring_tokens: Updates the attributes of a datastore version .
code: def edit(self, req, body, tenant_id, id):
          """Updates the attributes of a datastore version."""
          context = req.environ[wsgi.CONTEXT_KEY]
          datastore_version = models.DatastoreVersion.load_by_uuid(id)
  
          LOG.info(_("Tenant: '%(tenant)s' is updating the datastore "
                     "version: '%(version)s' for datastore: '%(datastore)s'") %
                   {'tenant': tenant_id, 'version': datastore_version.name,
                    'datastore': datastore_version.datastore_name})
  
          manager = body.get('datastore_manager', datastore_version.manager)
          image_id = body.get('image', datastore_version.image_id)
          active = body.get('active', datastore_version.active)
          default = body.get('default', None)
          packages = body.get('packages', datastore_version.packages)
          if type(packages) is list:
              packages = ','.join(packages)
  
          client = remote.create_nova_client(context)
          try:
              client.images.get(image_id)
          except nova_exceptions.NotFound:
              raise exception.ImageNotFound(uuid=image_id)
  
          models.update_datastore_version(datastore_version.datastore_name,
                                          datastore_version.name,
                                          manager, image_id, packages,
                                          active)
  
          if default:
              models.update_datastore(datastore_version.datastore_name,
                                      datastore_version.name)
          elif (default is False and datastore_version.default is True):
              models.update_datastore(datastore_version.datastore_name, None)
  
          return wsgi.Result(None, 202)
code_tokens: def edit ( self , req , body , tenant_id , id ) : context = req . environ [ wsgi . CONTEXT_KEY ] datastore_version = models . DatastoreVersion . load_by_uuid ( id ) LOG . info ( _ ( "Tenant: '%(tenant)s' is updating the datastore " "version: '%(version)s' for datastore: '%(datastore)s'" ) % { 'tenant' : tenant_id , 'version' : datastore_version . name , 'datastore' : datastore_version . datastore_name } ) manager = body . get ( 'datastore_manager' , datastore_version . manager ) image_id = body . get ( 'image' , datastore_version . image_id ) active = body . get ( 'active' , datastore_version . active ) default = body . get ( 'default' , None ) packages = body . get ( 'packages' , datastore_version . packages ) if type ( packages ) is list : packages = ',' . join ( packages ) client = remote . create_nova_client ( context ) try : client . images . get ( image_id ) except nova_exceptions . NotFound : raise exception . ImageNotFound ( uuid = image_id ) models . update_datastore_version ( datastore_version . datastore_name , datastore_version . name , manager , image_id , packages , active ) if default : models . update_datastore ( datastore_version . datastore_name , datastore_version . name ) elif ( default is False and datastore_version . default is True ) : models . update_datastore ( datastore_version . datastore_name , None ) return wsgi . Result ( None , 202 )
short_docstring: Updates the attributes of a datastore version.
short_docstring_tokens: Updates the attributes of a datastore version .
comment: """Updates the attributes of a datastore version."""