2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/ukku/set_var_command.rb', line 2
def execute(args)
var_name = args['VAR_NAME']
var_value = args['VAR_VALUE']
data = YAML.load_file(UKKU_FILE)
name, server = data.first
if name.nil?
raise "No application configured. Run 'ukku configure <host>' first."
end
if data.length > 1
if args['--app'].empty?
raise "No app specified, use the --app NAME option"
else
name = args[--app]
sever = data[name]
end
end
host = server['host']
user = server['user']
identity_file = server['identity_file']
conn = Connection.new(host, user, identity_file)
conn.execute("sudo mkdir -p /etc/ukku/vars && echo '#{var_value}' > /etc/ukku/vars/#{var_name}")
begin
conn.execute("launchapp")
rescue Subprocess::NonZeroExit => e
end
end
|