Skip to content

Instantly share code, notes, and snippets.

`ssh root@#{server} \"su postgres -c \"psql -d postgres -c \$\'alter user postgres with encrypted password \'#{test}\'\'\" \" ``
client_ip = data_bag_item('clientip', "#{node['fqdn']}")
default[:postgresql][:client_address] = "#{client_ip['client_ip']}"
Databag Item: dpq7yoky2sw4tg
Attribute Value
client_ip 127.0.0.1
id dpq7yoky2sw4tg
client_ip_info = data_bag('remote-pg-ip')
client_ip = data_bag_item('remote-pg-ip',"#{node[:hostname]}")
default[:postgresql][:listen_addresses] = "*"
default[:postgresql][:client_address] = "#{client_ip[:client_ip]}"
Sat, 06 Oct 2012 19:19:12 +0000] INFO: Starting Chef Run for dpq7yoky2sw4tg
ruby-1.9.3-rc1 :222 > @data_bag.attrs{"items"}
=> {"name"=>"remote-pg-ip", "items"=>[#<Spice::DataBagItem:0x000000061e6468 @attrs={"client_ip"=>"71.85.232.80", "id"=>"dpq7yoky2sw4tg"}>]}
ruby-1.9.3-rc1 :223 > @data_bag.attrs
=> {"name"=>"remote-pg-ip", "items"=>[#<Spice::DataBagItem:0x000000061e6468 @attrs={"client_ip"=>"71.85.232.80", "id"=>"dpq7yoky2sw4tg"}>]}
ruby-1.9.3-rc1 :224 > @data_bag.attrs.class
=> Hash
Spice.post("/data/user_ips",@databag)
=> {"error"=>["Data Bag items must have an id matching /^[\\-[:alnum:]_]+$/, you gave: nil"]}
ruby-1.9.3-rc1 :141 > @databag = Spice.data_bag("user_ips")
=> #<Spice::DataBag:0x000000046092e0 @attrs={"name"=>"user_ips", "items"=>[]}>
ruby-1.9.3-rc1 :142 > @databag.items = [{id: "user-ips"}]
=> [{:id=>"user-ips"}]
ruby-1.9.3-rc1 :143 > Spice.post("/data/user_ips",@databag)
=> {"error"=>["Data Bag items must have an id matching /^[\\-[:alnum:]_]+$/, you gave: nil"]}
ruby-1.9.3-rc1 :144 > @databag.items
=> [{:id=>"user-ips"}]
/etc/postgresql/9.1/main/pg_hba.conf
# Database administrative login by Unix domain socket
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
li.innerHTML = '<h3><a href="' + entry.link + '">' + entry.title + '</a>' + '<cite>by ' + entry.author + '</cite></h3>';
def create
plan = params[:subscription][:plan]
params[:subscription].delete(:plan)
@subscription = Subscription.new(params[:subscription])
@subscription.plan = plan
@user = User.new(params[:user])
respond_to do |format|
if @subscription.save_with_payment(@subscription.plan, @user.email) && @user.save
@subscription.user_id = @user.id
@subscription.save
def index
@servers = current_user.servers
@servers.each do |server|
@databases = Spice.get("/nodes/#{server.domain_name}")
end
end