megam_api 0.13 → 0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a89e917fbfd15f7068d3212e2c9a6b14a689471c
4
- data.tar.gz: 3ef8e5d63add9b4c3a8811969dd6e467a6922d1a
3
+ metadata.gz: 648894d0115816c314368168eea83b0652a95aec
4
+ data.tar.gz: 83dd55046ccfc9dcbd92fe5a93c5ec37bb780275
5
5
  SHA512:
6
- metadata.gz: 0f0ac5caf0e46baece23ea5b71ebcf7884f5d8c29492a9339e9e934a8fefe2f90acda6e7fed27da8161e5c97b6b6c889e08f07dd944ae8baa86f0079f3b3c65a
7
- data.tar.gz: 167c28d98d7d059b0a62118cc349ef896d3d9a6c53a6478dd5c66f45c672a381091aa3be7b9f92624881aab0c2d85648340ccb6bf90665949160f3eab178330f
6
+ metadata.gz: f4c050bba42496e59abcb765f6fab5f664f2b07d104f47737579f82a806279b08dfb636925ba4a062884c2f09c555992d9f03afe12ae8d2e482cd7be8adb50b9
7
+ data.tar.gz: aa046a0bd7cbc4b2e1760218739c26e57e9377d8f8c7f63fab83fa6b009c729f1ea3cee620c6c72143912b5b38682e1c430f4ce96c784e43399f592aa59a6aa3
@@ -31,6 +31,17 @@ module Megam
31
31
  :body => @options[:body]
32
32
  )
33
33
  end
34
+
35
+ def update_appdefn(new_appdefn)
36
+ @options = {:path => '/appdefns/update',
37
+ :body => Megam::JSONCompat.to_json(new_appdefn)}.merge(@options)
38
+
39
+ request(
40
+ :expects => 201,
41
+ :method => :post,
42
+ :body => @options[:body]
43
+ )
44
+ end
34
45
 
35
46
  end
36
47
  end
@@ -23,5 +23,17 @@ module Megam
23
23
  )
24
24
  end
25
25
 
26
+ def update_boltdefn(new_boltdefn)
27
+ @options = {:path => '/boltdefns/update',
28
+ :body => Megam::JSONCompat.to_json(new_boltdefn)}.merge(@options)
29
+
30
+ request(
31
+ :expects => 201,
32
+ :method => :post,
33
+ :body => @options[:body]
34
+ )
35
+ end
36
+
37
+
26
38
  end
27
39
  end
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.13"
3
+ VERSION = "0.14"
4
4
  end
5
5
  end
@@ -101,8 +101,8 @@ module Megam
101
101
  "command" => command_hash,
102
102
  "predefs" => {"name" => data[:predef_name], "scm" => "#{data[:deps_scm]}",
103
103
  "db" => "postgres@postgresql1.megam.com/morning.megam.co", "war" => "#{data[:deps_war]}", "queue" => "queue@queue1", "runtime_exec" => data[:runtime_exec]},
104
- "appdefns" => {"timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => ""},
105
- "boltdefns" => {"username" => "", "apikey" => "", "store_name" => "", "url" => "", "prime" => "", "timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => ""},
104
+ "appdefns" => {"timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => "", "env_sh" => ""},
105
+ "boltdefns" => {"username" => "", "apikey" => "", "store_name" => "", "url" => "", "prime" => "", "timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => "", "env_sh" => ""},
106
106
  "appreq" => {},
107
107
  "boltreq" => {}
108
108
  }
@@ -114,10 +114,10 @@ module Megam
114
114
  if data[:deps_war].length > 0
115
115
  data[:runtime_exec] = change_runtime(data[:deps_war], data[:runtime_exec], action)
116
116
  end
117
- node_hash["appdefns"] = {"timetokill" => "#{data[:timetokill]}", "metered" => "#{data[:metered]}", "logging" => "#{data[:logging]}", "runtime_exec" => "#{data[:runtime_exec]}"}
117
+ node_hash["appdefns"] = {"timetokill" => "#{data[:timetokill]}", "metered" => "#{data[:metered]}", "logging" => "#{data[:logging]}", "runtime_exec" => "#{data[:runtime_exec]}", "env_sh" => "#{data[:env_sh]}"}
118
118
  end
119
119
  if data[:book_type] == "BOLT"
120
- node_hash["boltdefns"] = {"username" => "#{data['user_name']}", "apikey" => "#{data['password']}", "store_name" => "#{data['store_db_name']}", "url" => "#{data['url']}", "prime" => "#{data['prime']}", "timetokill" => "#{data['timetokill']}", "metered" => "#{data['monitoring']}", "logging" => "#{data['logging']}", "runtime_exec" => "#{data['runtime_exec']}" }
120
+ node_hash["boltdefns"] = {"username" => "#{data['user_name']}", "apikey" => "#{data['password']}", "store_name" => "#{data['store_db_name']}", "url" => "#{data['url']}", "prime" => "#{data['prime']}", "timetokill" => "#{data['timetokill']}", "metered" => "#{data['monitoring']}", "logging" => "#{data['logging']}", "runtime_exec" => "#{data['runtime_exec']}", "env_sh" => "#{data[:env_sh]}" }
121
121
  end
122
122
  node_hash
123
123
  end
@@ -127,6 +127,7 @@ module Megam
127
127
  appdefns.appdefns[:metered] = op["metered"] if op && op.has_key?("metered")
128
128
  appdefns.appdefns[:logging]= op["logging"] if op && op.has_key?("logging")
129
129
  appdefns.appdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
130
+ appdefns.appdefns[:env_sh] = op["env_sh"] if op && op.has_key?("env_sh")
130
131
 
131
132
  appdefns.some_msg[:code] = o["code"] if o.has_key?("code")
132
133
  appdefns.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
@@ -152,6 +152,7 @@ module Megam
152
152
  boltdefns.boltdefns[:metered] = op["metered"] if op && op.has_key?("metered")
153
153
  boltdefns.boltdefns[:logging]= op["logging"] if op && op.has_key?("logging")
154
154
  boltdefns.boltdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
155
+ boltdefns.boltdefns[:env_sh] = op["env_sh"] if op && op.has_key?("env_sh")
155
156
 
156
157
  boltdefns.some_msg[:code] = o["code"] if o.has_key?("code")
157
158
  boltdefns.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
@@ -21,7 +21,7 @@ module Megam
21
21
  @node_id = nil
22
22
  @node_name = nil
23
23
  @marketplace_id = nil
24
- @config = {}
24
+ @config = nil
25
25
  @config_id = nil
26
26
  @created_at = nil
27
27
  @some_msg = {}
@@ -127,7 +127,7 @@ module Megam
127
127
  "node_id" => node_id,
128
128
  "node_name" => node_name,
129
129
  "marketplace_id" => marketplace_id,
130
- "config" => config,
130
+ "config" => {},
131
131
  "config_id" => config_id,
132
132
  "created_at" => created_at
133
133
  }
@@ -144,7 +144,7 @@ module Megam
144
144
  addon.config(o["config"]) if o.has_key?("config")
145
145
  addon.config_id(o["config_id"]) if o.has_key?("config_id")
146
146
  addon.created_at(o["created_at"]) if o.has_key?("created_at")
147
-
147
+
148
148
  addon.some_msg[:code] = o["code"] if o.has_key?("code")
149
149
  addon.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
150
150
  addon.some_msg[:msg]= o["msg"] if o.has_key?("msg")
@@ -289,6 +289,7 @@ node.command[:cloudtool][:chef][:name] = oc["cloudtool"]["chef"]["name"]
289
289
  node.appdefns[:metered] = op["metered"] if op && op.has_key?("metered")
290
290
  node.appdefns[:logging]= op["logging"] if op && op.has_key?("logging")
291
291
  node.appdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
292
+ node.appdefns[:env_sh] = op["env_sh"] if op && op.has_key?("env_sh")
292
293
 
293
294
  #BOLT DEFINITIONS
294
295
  op = o["boltdefns"]
@@ -300,6 +301,7 @@ node.command[:cloudtool][:chef][:name] = oc["cloudtool"]["chef"]["name"]
300
301
  node.boltdefns[:metered] = op["metered"] if op && op.has_key?("metered")
301
302
  node.boltdefns[:logging]= op["logging"] if op && op.has_key?("logging")
302
303
  node.boltdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
304
+ node.boltdefns[:env_sh] = op["env_sh"] if op && op.has_key?("env_sh")
303
305
 
304
306
  #success or error
305
307
  node.some_msg[:code] = o["code"] if o.has_key?("code")
@@ -1,10 +1,11 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestApps < MiniTest::Unit::TestCase
4
+ =begin
4
5
  def test_post_appdefns
5
6
  tmp_hash = {
6
7
  "node_name" => "black1.megam.co",
7
- "appdefns" => {"timetokill" => "test1", "metered" => "test1", "logging" => "test1", "runtime_exec" => "test"}
8
+ "appdefns" => {"timetokill" => "test1", "metered" => "test1", "logging" => "test1", "runtime_exec" => "test", "env_sh" => "changed env_sh"}
8
9
  }
9
10
  response = megams.post_appdefn(tmp_hash)
10
11
  assert_equal(201, response.status)
@@ -19,5 +20,16 @@ class TestApps < MiniTest::Unit::TestCase
19
20
  response = megams.get_appdefn("asphyxiated1.megam.co","ADF412857952341327872")
20
21
  assert_equal(200, response.status)
21
22
  end
23
+ =end
24
+ def test_post_appdefns
25
+ tmp_hash = {
26
+ "appdefn_id" => "ADF456016953832636416",
27
+ "node_name" => "appsample1.megam.co",
28
+ "runtime_exec" => "test",
29
+ "env_sh" => "changed env_sh"
30
+ }
31
+ response = megams.update_appdefn(tmp_hash)
32
+ assert_equal(201, response.status)
33
+ end
22
34
 
23
35
  end
@@ -1,12 +1,12 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestApps < MiniTest::Unit::TestCase
4
-
4
+ =begin
5
5
  def test_post_boltdefns
6
6
 
7
7
  tmp_hash = {
8
8
  "node_name" => "black1.megam.co",
9
- "boltdefns" => {"username" => "new", "apikey" => "new", "store_name" => "", "url" => "", "prime" => "", "timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => ""}
9
+ "boltdefns" => {"username" => "new", "apikey" => "new", "store_name" => "", "url" => "", "prime" => "", "timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => "", "env_sh" => "changed env_sh"}
10
10
  }
11
11
 
12
12
  response = megams.post_boltdefn(tmp_hash)
@@ -17,5 +17,16 @@ class TestApps < MiniTest::Unit::TestCase
17
17
  response = megams.get_boltdefn("black1.megam.co")
18
18
  assert_equal(200, response.status)
19
19
  end
20
+ =end
21
+ def test_post_boltdefns
22
+ tmp_hash = {
23
+ "boltdefn_id" => "BDF456048363326930944",
24
+ "node_name" => "appsample1.megam.co",
25
+ "runtime_exec" => "test",
26
+ "env_sh" => "changed env_sh"
27
+ }
28
+ response = megams.update_boltdefn(tmp_hash)
29
+ assert_equal(201, response.status)
30
+ end
20
31
 
21
32
  end
@@ -7,19 +7,23 @@ def test_post_addon
7
7
  "disaster"=>{
8
8
  "locations"=>"locations",
9
9
  "fromhost"=>"appsample1.megam.co",
10
- "tohosts"=>"appsample2.megam.co;appsample3.megam.co"
10
+ "tohosts"=>"appsample2.megam.co;appsample3.megam.co",
11
+ "recipe"=>"role[drbd]"
11
12
  },
12
13
  "loadbalancing"=>{
13
14
  "haproxyhost"=>"",
14
- "loadbalancehost"=>""
15
+ "loadbalancehost"=>"",
16
+ "recipe"=>""
15
17
  },
16
18
  "autoscaling"=>{
17
19
  "cputhreshold"=>"",
18
20
  "memorythreshold"=>"",
19
- "noofinstances"=>""
21
+ "noofinstances"=>"",
22
+ "recipe"=>""
20
23
  },
21
24
  "monitoring"=>{
22
- "agent"=>"op5"
25
+ "agent"=>"op5",
26
+ "recipe"=>"role[op5]"
23
27
  }
24
28
  }
25
29
 
data/test/test_nodes.rb CHANGED
@@ -46,8 +46,8 @@ class TestApps < MiniTest::Unit::TestCase
46
46
  "command" => @com,
47
47
  "predefs" => {"name" => "rails", "scm" => "",
48
48
  "db" => "postgres@postgresql1.megam.com/night.megam.co", "war" => "http://s3pub.com/0.1/granny.war", "queue" => "queue@queue1", "runtime_exec" => "sudo start rails"},
49
- "appdefns" => {"timetokill" => "0", "metered" => "megam", "logging" => "megam", "runtime_exec" => "start unicorn_<projectname>"},
50
- "boltdefns" => {"username" => "", "apikey" => "", "store_name" => "", "url" => "", "prime" => "", "timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => ""},
49
+ "appdefns" => {"timetokill" => "0", "metered" => "megam", "logging" => "megam", "runtime_exec" => "start unicorn_<projectname>", "env_sh" => "changed env_sh"},
50
+ "boltdefns" => {"username" => "", "apikey" => "", "store_name" => "", "url" => "", "prime" => "", "timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => "", "env_sh" => "changed env_sh"},
51
51
  "appreq" => {},
52
52
  "boltreq" => {}
53
53
  }
@@ -67,16 +67,19 @@ class TestApps < MiniTest::Unit::TestCase
67
67
  assert_equal(201, response.status)
68
68
  end
69
69
  =end
70
+ =begin
70
71
  def test_get_nodes
71
72
  response = megams.get_nodes
72
73
  assert_equal(200, response.status)
73
74
  end
74
- =begin
75
+ =end
76
+ #=begin
75
77
  def test_get_node0
76
- response = megams.get_node("black1.megam.co")
78
+ response = megams.get_node("appsample1.megam.co")
77
79
  assert_equal(200, response.status)
78
80
  end
79
-
81
+ #=end
82
+ =begin
80
83
  def test_get_node1
81
84
  response = megams.get_node("night.megam.co")
82
85
  assert_equal(200, response.status)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megam_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.13'
4
+ version: '0.14'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kishorekumar Neelamegam, Thomas Alrin, Subash Sethurajan, Rajthilak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -234,3 +234,4 @@ signing_key:
234
234
  specification_version: 4
235
235
  summary: Ruby Client for the Megam Cloud
236
236
  test_files: []
237
+ has_rdoc: