chef/cookbooks/keystone/providers/register.rb
def add_item(path, body, name)
  resp = session.put(path, body)
  if resp.is_a?(Net::HTTPOK)
    Chef::Log.info("Updated keystone item '#{name}'")
    return true
  elsif resp.is_a?(Net::HTTPCreated)
    Chef::Log.info("Created keystone item '#{name}'")
    return true
  # several APIs use 204 on v3 as success response
  elsif resp.is_a?(Net::HTTPNoContent)
    Chef::Log.info("Created/Updated keystone item #{name}")
    return true
  else
    log_message = "Unable to add item '#{name}'"
    raise_error(resp, log_message, "add_item")
  end
end
# Make a PUT request to upload an object or create relationships between
# objects (such as role assignments)
Make a PUT request to upload an object or create relationships between
objects (such as role assignments)
Make a PUT request to upload an object or create relationships between objects ( such as role assignments )
def add_item(path, body, name)
  resp = session.put(path, body)
  if resp.is_a?(Net::HTTPOK)
    Chef::Log.info("Updated keystone item '#{name}'")
    return true
  elsif resp.is_a?(Net::HTTPCreated)
    Chef::Log.info("Created keystone item '#{name}'")
    return true
  elsif resp.is_a?(Net::HTTPNoContent)
    Chef::Log.info("Created/Updated keystone item #{name}")
    return true
  else
    log_message = "Unable to add item '#{name}'"
    raise_error(resp, log_message, "add_item")
  end
end
def add_item ( path , body , name ) resp = session . put ( path , body ) if resp . is_a? ( Net :: HTTPOK ) Chef :: Log . info ( "Updated keystone item '#{name}'" ) return true elsif resp . is_a? ( Net :: HTTPCreated ) Chef :: Log . info ( "Created keystone item '#{name}'" ) return true elsif resp . is_a? ( Net :: HTTPNoContent ) Chef :: Log . info ( "Created/Updated keystone item #{name}" ) return true else log_message = "Unable to add item '#{name}'" raise_error ( resp , log_message , "add_item" ) end end
Make a PUT request to upload an object or create relationships between
objects (such as role assignments)
Make a PUT request to upload an object or create relationships between objects ( such as role assignments )
# several APIs use 204 on v3 as success response
path
body
name