Class: GV::Addons::Etcd

Inherits:
Valley::Addon show all
Defined in:
lib/gv/addons/etcd.rb

Constant Summary collapse

PORT =
4001
CONTAINER_DIR =
"/data/db"

Instance Method Summary collapse

Methods inherited from Valley::Addon

#info, #initialize, #port

Constructor Details

This class inherits a constructor from GV::Valley::Addon

Instance Method Details

#cmdObject



18
19
20
# File 'lib/gv/addons/etcd.rb', line 18

def cmd
  "--name=#{@app_name} -data-dir=#{CONTAINER_DIR}"
end

#create(app_name) ⇒ Object



27
28
29
30
# File 'lib/gv/addons/etcd.rb', line 27

def create app_name
  super app_name
  self.class.space.write([@name.to_sym,@app_name,"http://#{self.external_ip}:#{port(app_name)}",self.external_ip])    
end

#destroy(app_name) ⇒ Object



32
33
34
35
36
# File 'lib/gv/addons/etcd.rb', line 32

def destroy app_name
  super app_name
  tuple = [@name.to_sym,@app_name,nil,nil]
  (self.class.space.take(tuple,0) rescue nil) while (self.class.space.read(tuple,0) rescue nil)
end

#imageObject



12
# File 'lib/gv/addons/etcd.rb', line 12

def image; "flynn/etcd" end

#paramsObject



14
15
16
# File 'lib/gv/addons/etcd.rb', line 14

def params 
  "-v #{@home}/#{@name}/#{@app_name}:#{CONTAINER_DIR}:rw"
end

#url(app_name) ⇒ Object



22
23
24
25
# File 'lib/gv/addons/etcd.rb', line 22

def url app_name
  @app_name = app_name
  self.class.space.read([@name.to_sym,@app_name,nil,nil],0) rescue nil
end