poolparty 1.3.4 → 1.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. data/Rakefile +2 -2
  2. data/VERSION.yml +1 -1
  3. data/bin/cloud-bootstrap +1 -0
  4. data/bin/cloud-configure +1 -0
  5. data/bin/cloud-contract +1 -0
  6. data/bin/cloud-misc +34 -0
  7. data/bin/cloud-setup +36 -0
  8. data/bin/cloud-ssh +4 -1
  9. data/config/jeweler.rb +4 -3
  10. data/examples/monitored_cloud.rb +1 -1
  11. data/examples/thrift/thrift_example.rb +5 -3
  12. data/examples/vmware.rb +28 -0
  13. data/lib/cloud_providers/cloud_provider_instance.rb +14 -5
  14. data/lib/cloud_providers/connections.rb +1 -1
  15. data/lib/core/file.rb +12 -0
  16. data/lib/core/object.rb +2 -2
  17. data/lib/dependency_resolvers/base.rb +1 -1
  18. data/lib/dependency_resolvers/chef.rb +9 -7
  19. data/lib/dependency_resolvers/proxy_object.rb +11 -3
  20. data/lib/mixins/askable.rb +16 -7
  21. data/lib/poolparty/base.rb +8 -7
  22. data/lib/poolparty/cloud.rb +77 -7
  23. data/lib/poolparty/default.rb +1 -0
  24. data/lib/poolparty/installer.rb +8 -4
  25. data/lib/poolparty/installers/ec2.rb +75 -5
  26. data/lib/poolparty/installers/vmware.rb +17 -5
  27. data/lib/poolparty/plugin.rb +1 -5
  28. data/lib/poolparty/plugins/apache.rb +10 -7
  29. data/lib/poolparty/plugins/apache2/base.conf.erb +2 -2
  30. data/lib/poolparty/plugins/apache2/browser_fixes.conf.erb +1 -1
  31. data/lib/poolparty/plugins/apache2/passenger_site.rb +2 -2
  32. data/lib/poolparty/plugins/collectd/templates/collectd.conf.erb +369 -0
  33. data/lib/poolparty/plugins/collectd.rb +24 -0
  34. data/lib/poolparty/plugins/hermes.rb +89 -0
  35. data/lib/poolparty/pool.rb +33 -3
  36. data/lib/poolparty/resource.rb +32 -18
  37. data/lib/poolparty/resources/directory.rb +5 -1
  38. data/lib/poolparty/resources/exec.rb +2 -2
  39. data/lib/poolparty/resources/file.rb +8 -2
  40. data/lib/poolparty/resources/gem_package.rb +2 -2
  41. data/lib/poolparty/resources/line.rb +23 -6
  42. data/lib/poolparty/resources/mount.rb +2 -2
  43. data/lib/poolparty/resources/package.rb +2 -2
  44. data/lib/poolparty/resources/service.rb +2 -2
  45. data/lib/poolparty/resources/user.rb +2 -2
  46. data/lib/poolparty/resources/variable.rb +4 -3
  47. data/lib/poolparty.rb +5 -3
  48. data/lib/proto/command_interface_handler.rb +17 -1
  49. data/lib/proto/gen-py/cloudthrift/CommandInterface.pyc +0 -0
  50. data/lib/proto/gen-py/cloudthrift/__init__.pyc +0 -0
  51. data/lib/proto/gen-py/cloudthrift/constants.pyc +0 -0
  52. data/lib/proto/gen-py/cloudthrift/ttypes.pyc +0 -0
  53. data/lib/proto/gen-py/thrift/Thrift.pyc +0 -0
  54. data/lib/proto/gen-py/thrift/__init__.pyc +0 -0
  55. data/lib/proto/gen-py/thrift/protocol/TBinaryProtocol.pyc +0 -0
  56. data/lib/proto/gen-py/thrift/protocol/TProtocol.pyc +0 -0
  57. data/lib/proto/gen-py/thrift/protocol/__init__.pyc +0 -0
  58. data/lib/proto/gen-py/thrift/transport/TSocket.pyc +0 -0
  59. data/lib/proto/gen-py/thrift/transport/TTransport.pyc +0 -0
  60. data/lib/proto/gen-py/thrift/transport/__init__.pyc +0 -0
  61. data/test/lib/dependency_resolvers/chef_test.rb +92 -100
  62. data/test/lib/poolparty/base_test.rb +13 -0
  63. data/test/lib/poolparty/cloud_test.rb +50 -2
  64. data/test/lib/poolparty/monitor_test.rb +2 -2
  65. data/test/lib/poolparty/resource_test.rb +5 -0
  66. data/test/lib/poolparty/resources/line_test.rb +3 -3
  67. data/test/lib/poolparty/resources/service_test.rb +1 -1
  68. data/test/lib/poolparty/resources/variable_test.rb +33 -10
  69. data/vendor/gems/net-ssh/CHANGELOG.rdoc +127 -0
  70. data/vendor/gems/net-ssh/Manifest +104 -0
  71. data/vendor/gems/net-ssh/README.rdoc +110 -0
  72. data/vendor/gems/net-ssh/Rakefile +26 -0
  73. data/vendor/gems/net-ssh/THANKS.rdoc +16 -0
  74. data/vendor/gems/net-ssh/lib/net/ssh/authentication/agent.rb +176 -0
  75. data/vendor/gems/net-ssh/lib/net/ssh/authentication/constants.rb +18 -0
  76. data/vendor/gems/net-ssh/lib/net/ssh/authentication/key_manager.rb +193 -0
  77. data/vendor/gems/net-ssh/lib/net/ssh/authentication/methods/abstract.rb +60 -0
  78. data/vendor/gems/net-ssh/lib/net/ssh/authentication/methods/hostbased.rb +71 -0
  79. data/vendor/gems/net-ssh/lib/net/ssh/authentication/methods/keyboard_interactive.rb +66 -0
  80. data/vendor/gems/net-ssh/lib/net/ssh/authentication/methods/password.rb +39 -0
  81. data/vendor/gems/net-ssh/lib/net/ssh/authentication/methods/publickey.rb +92 -0
  82. data/vendor/gems/net-ssh/lib/net/ssh/authentication/pageant.rb +183 -0
  83. data/vendor/gems/net-ssh/lib/net/ssh/authentication/session.rb +134 -0
  84. data/vendor/gems/net-ssh/lib/net/ssh/buffer.rb +340 -0
  85. data/vendor/gems/net-ssh/lib/net/ssh/buffered_io.rb +149 -0
  86. data/vendor/gems/net-ssh/lib/net/ssh/config.rb +181 -0
  87. data/vendor/gems/net-ssh/lib/net/ssh/connection/channel.rb +625 -0
  88. data/vendor/gems/net-ssh/lib/net/ssh/connection/constants.rb +33 -0
  89. data/vendor/gems/net-ssh/lib/net/ssh/connection/session.rb +596 -0
  90. data/vendor/gems/net-ssh/lib/net/ssh/connection/term.rb +178 -0
  91. data/vendor/gems/net-ssh/lib/net/ssh/errors.rb +85 -0
  92. data/vendor/gems/net-ssh/lib/net/ssh/key_factory.rb +102 -0
  93. data/vendor/gems/net-ssh/lib/net/ssh/known_hosts.rb +129 -0
  94. data/vendor/gems/net-ssh/lib/net/ssh/loggable.rb +61 -0
  95. data/vendor/gems/net-ssh/lib/net/ssh/packet.rb +102 -0
  96. data/vendor/gems/net-ssh/lib/net/ssh/prompt.rb +93 -0
  97. data/vendor/gems/net-ssh/lib/net/ssh/proxy/errors.rb +14 -0
  98. data/vendor/gems/net-ssh/lib/net/ssh/proxy/http.rb +94 -0
  99. data/vendor/gems/net-ssh/lib/net/ssh/proxy/socks4.rb +70 -0
  100. data/vendor/gems/net-ssh/lib/net/ssh/proxy/socks5.rb +129 -0
  101. data/vendor/gems/net-ssh/lib/net/ssh/ruby_compat.rb +7 -0
  102. data/vendor/gems/net-ssh/lib/net/ssh/service/forward.rb +267 -0
  103. data/vendor/gems/net-ssh/lib/net/ssh/test/channel.rb +129 -0
  104. data/vendor/gems/net-ssh/lib/net/ssh/test/extensions.rb +152 -0
  105. data/vendor/gems/net-ssh/lib/net/ssh/test/kex.rb +44 -0
  106. data/vendor/gems/net-ssh/lib/net/ssh/test/local_packet.rb +51 -0
  107. data/vendor/gems/net-ssh/lib/net/ssh/test/packet.rb +81 -0
  108. data/vendor/gems/net-ssh/lib/net/ssh/test/remote_packet.rb +38 -0
  109. data/vendor/gems/net-ssh/lib/net/ssh/test/script.rb +157 -0
  110. data/vendor/gems/net-ssh/lib/net/ssh/test/socket.rb +59 -0
  111. data/vendor/gems/net-ssh/lib/net/ssh/test.rb +89 -0
  112. data/vendor/gems/net-ssh/lib/net/ssh/transport/algorithms.rb +384 -0
  113. data/vendor/gems/net-ssh/lib/net/ssh/transport/cipher_factory.rb +80 -0
  114. data/vendor/gems/net-ssh/lib/net/ssh/transport/constants.rb +30 -0
  115. data/vendor/gems/net-ssh/lib/net/ssh/transport/hmac/abstract.rb +78 -0
  116. data/vendor/gems/net-ssh/lib/net/ssh/transport/hmac/md5.rb +12 -0
  117. data/vendor/gems/net-ssh/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
  118. data/vendor/gems/net-ssh/lib/net/ssh/transport/hmac/none.rb +15 -0
  119. data/vendor/gems/net-ssh/lib/net/ssh/transport/hmac/sha1.rb +13 -0
  120. data/vendor/gems/net-ssh/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
  121. data/vendor/gems/net-ssh/lib/net/ssh/transport/hmac.rb +31 -0
  122. data/vendor/gems/net-ssh/lib/net/ssh/transport/identity_cipher.rb +55 -0
  123. data/vendor/gems/net-ssh/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +208 -0
  124. data/vendor/gems/net-ssh/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +77 -0
  125. data/vendor/gems/net-ssh/lib/net/ssh/transport/kex.rb +13 -0
  126. data/vendor/gems/net-ssh/lib/net/ssh/transport/openssl.rb +128 -0
  127. data/vendor/gems/net-ssh/lib/net/ssh/transport/packet_stream.rb +230 -0
  128. data/vendor/gems/net-ssh/lib/net/ssh/transport/server_version.rb +60 -0
  129. data/vendor/gems/net-ssh/lib/net/ssh/transport/session.rb +276 -0
  130. data/vendor/gems/net-ssh/lib/net/ssh/transport/state.rb +201 -0
  131. data/vendor/gems/net-ssh/lib/net/ssh/verifiers/lenient.rb +30 -0
  132. data/vendor/gems/net-ssh/lib/net/ssh/verifiers/null.rb +12 -0
  133. data/vendor/gems/net-ssh/lib/net/ssh/verifiers/strict.rb +53 -0
  134. data/vendor/gems/net-ssh/lib/net/ssh/version.rb +62 -0
  135. data/vendor/gems/net-ssh/lib/net/ssh.rb +215 -0
  136. data/vendor/gems/net-ssh/net-ssh.gemspec +33 -0
  137. data/vendor/gems/net-ssh/setup.rb +1585 -0
  138. data/vendor/gems/net-ssh/test/authentication/methods/common.rb +28 -0
  139. data/vendor/gems/net-ssh/test/authentication/methods/test_abstract.rb +51 -0
  140. data/vendor/gems/net-ssh/test/authentication/methods/test_hostbased.rb +114 -0
  141. data/vendor/gems/net-ssh/test/authentication/methods/test_keyboard_interactive.rb +98 -0
  142. data/vendor/gems/net-ssh/test/authentication/methods/test_password.rb +50 -0
  143. data/vendor/gems/net-ssh/test/authentication/methods/test_publickey.rb +127 -0
  144. data/vendor/gems/net-ssh/test/authentication/test_agent.rb +205 -0
  145. data/vendor/gems/net-ssh/test/authentication/test_key_manager.rb +105 -0
  146. data/vendor/gems/net-ssh/test/authentication/test_session.rb +93 -0
  147. data/vendor/gems/net-ssh/test/common.rb +106 -0
  148. data/vendor/gems/net-ssh/test/configs/eqsign +3 -0
  149. data/vendor/gems/net-ssh/test/configs/exact_match +8 -0
  150. data/vendor/gems/net-ssh/test/configs/wild_cards +14 -0
  151. data/vendor/gems/net-ssh/test/connection/test_channel.rb +452 -0
  152. data/vendor/gems/net-ssh/test/connection/test_session.rb +488 -0
  153. data/vendor/gems/net-ssh/test/test_all.rb +6 -0
  154. data/vendor/gems/net-ssh/test/test_buffer.rb +336 -0
  155. data/vendor/gems/net-ssh/test/test_buffered_io.rb +63 -0
  156. data/vendor/gems/net-ssh/test/test_config.rb +84 -0
  157. data/vendor/gems/net-ssh/test/test_key_factory.rb +67 -0
  158. data/vendor/gems/net-ssh/test/transport/hmac/test_md5.rb +39 -0
  159. data/vendor/gems/net-ssh/test/transport/hmac/test_md5_96.rb +25 -0
  160. data/vendor/gems/net-ssh/test/transport/hmac/test_none.rb +34 -0
  161. data/vendor/gems/net-ssh/test/transport/hmac/test_sha1.rb +34 -0
  162. data/vendor/gems/net-ssh/test/transport/hmac/test_sha1_96.rb +25 -0
  163. data/vendor/gems/net-ssh/test/transport/kex/test_diffie_hellman_group1_sha1.rb +146 -0
  164. data/vendor/gems/net-ssh/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb +92 -0
  165. data/vendor/gems/net-ssh/test/transport/test_algorithms.rb +302 -0
  166. data/vendor/gems/net-ssh/test/transport/test_cipher_factory.rb +171 -0
  167. data/vendor/gems/net-ssh/test/transport/test_hmac.rb +34 -0
  168. data/vendor/gems/net-ssh/test/transport/test_identity_cipher.rb +40 -0
  169. data/vendor/gems/net-ssh/test/transport/test_packet_stream.rb +435 -0
  170. data/vendor/gems/net-ssh/test/transport/test_server_version.rb +57 -0
  171. data/vendor/gems/net-ssh/test/transport/test_session.rb +315 -0
  172. data/vendor/gems/net-ssh/test/transport/test_state.rb +173 -0
  173. metadata +116 -4
  174. data/bin/install-poolparty +0 -20
@@ -4,70 +4,74 @@ include_fixture_resources
4
4
  include_chef_only_resources
5
5
 
6
6
  class ChefTest < Test::Unit::TestCase
7
- include PoolParty
8
7
 
9
- context "chef dependency_resolver test" do
10
- setup do
11
- @base = DependencyResolvers::Chef
12
- @base.compile_directory = test_dir
13
- @cookboox_directory = test_dir/"cookbooks"/"poolparty"
14
-
15
- @resources = {
16
- :variables => Resources::Variable.new(:animal, "Duck"),
17
- :files => Resources::FileResource.new(:name => "/etc/motd", :content => "Welcome to a fake file"),
18
- :directories => Resources::Directory.new("/etc/poolparty"),
19
- :http_request => PoolParty::Resources::HttpRequest.new("posting data", :url => "http://check.in", :message => {:some => "data"}, :action => :post),
20
- :link => PoolParty::Resources::Link.new("/tmp/passwd", :to => "/etc/passwd"),
21
- :chef_recipe => PoolParty::Resources::ChefRecipe.new(fixtures_dir/"chef"/"recipes"/"sudo")
22
- }
23
- end
8
+ def setup
9
+ @base = DependencyResolvers::Chef
10
+ @base.compile_directory = test_dir
11
+ @cookboox_directory = test_dir/"cookbooks"/"poolparty"
24
12
 
25
- teardown do
26
- # FileUtils.rm_rf test_dir
27
- end
13
+ @resources = {
14
+ :variables => PoolParty::Resources::Variable.new(:bird, "Fowl"),
15
+ :files => PoolParty::Resources::FileResource.new(:name => "/etc/motd", :content => "Welcome to a fake file"),
16
+ :directories => PoolParty::Resources::Directory.new("/etc/poolparty"),
17
+ :http_request => PoolParty::Resources::HttpRequest.new("posting data", :url => "http://check.in", :message => {:some => "data"}, :action => :post),
18
+ :link => PoolParty::Resources::Link.new("/tmp/passwd", :to => "/etc/passwd"),
19
+ :chef_recipe => PoolParty::Resources::ChefRecipe.new(fixtures_dir/"chef"/"recipes"/"sudo")
20
+ }
28
21
 
29
- should "have compile to chef" do
30
- assert @base.respond_to?(:compile_method_name)
31
- assert_equal :print_to_chef, @base.compile_method_name
32
- end
22
+ PoolParty::Resource.define_resource_methods
23
+ @inst = FakeResource.new
24
+ @res = @resources[:link]
25
+ @inst.has_service("apache")
26
+ end
27
+
28
+ def teardown
29
+ FileUtils.rm_rf test_dir
30
+ end
31
+
32
+ def test_have_compile_to_chef
33
+ assert @base.respond_to?(:compile_method_name)
34
+ assert_equal :print_to_chef, @base.compile_method_name
35
+ end
33
36
 
34
- should "be able to compile a variable" do
35
- @base.compile_to(@resources[:variables], test_dir)
36
- cont = open(@cookboox_directory/"attributes"/"poolparty.rb").read
37
- assert_match /poolparty Mash\.new unless attribute\?\("poolparty"\)/, cont
38
- assert_match /poolparty\[:animal\] = \"Duck\"\n/, cont
39
- end
37
+ def test_be_able_to_compile_a_variable
38
+ @base.compile_to(@resources[:variables], test_dir)
39
+ cont = open(@cookboox_directory/"attributes"/"poolparty.rb").read
40
+ assert_match /poolparty Mash\.new unless attribute\?\("poolparty"\)/, cont
41
+ assert_match /poolparty\[:bird\] = \"Fowl\"\n/, cont
42
+ FileUtils.rm_rf test_dir
43
+ end
40
44
 
41
- should "be able to compile a file" do
42
- @base.compile_to(@resources[:files], test_dir)
43
- assert_equal "Welcome to a fake file", open(@cookboox_directory/"templates"/"default"/"etc"/"motd.erb").read
44
- end
45
+ def test_be_able_to_compile_a_file
46
+ @base.compile_to(@resources[:files], test_dir)
47
+ assert_equal "Welcome to a fake file", open(@cookboox_directory/"templates"/"default"/"etc"/"motd.erb").read
48
+ end
45
49
 
46
- should "be able to compile an http_request" do
47
- @base.compile_to(@resources[:http_request], test_dir)
48
- assert_equal "http_request \"posting data\" do\n action :post\n url \"http://check.in\"\n message :some => \"data\"\nend\n", open(@cookboox_directory/"recipes"/"default.rb").read
49
- end
50
+ def test_be_able_to_compile_an_http_request
51
+ @base.compile_to(@resources[:http_request], test_dir)
52
+ assert_equal "http_request \"posting data\" do\n action :post\n url \"http://check.in\"\n message :some => \"data\"\nend\n", open(@cookboox_directory/"recipes"/"default.rb").read
53
+ end
50
54
 
51
- should "compile to the recipes" do
52
- @base.compile_to(@resources[:files], test_dir)
53
- assert_equal "template \"/etc/motd\" do\n source \"/etc/motd.erb\"\n action :create\n backup 5\n mode 0644\n owner \"root\"\nend\n", open(@cookboox_directory/"recipes"/"default.rb").read
54
- end
55
+ def test_compile_to_the_recipes
56
+ @base.compile_to(@resources[:files], test_dir)
57
+ assert_equal "template \"/etc/motd\" do\n source \"/etc/motd.erb\"\n action :create\n backup 5\n mode 0644\n owner \"root\"\nend\n", open(@cookboox_directory/"recipes"/"default.rb").read
58
+ end
55
59
 
56
- should "compile the recipes" do
57
- @base.compile_to(@resources[:chef_recipe], test_dir)
58
- assert_equal open(fixtures_dir/"chef"/"recipes"/"sudo"/"recipes"/"default.rb").read, open(@cookboox_directory/".."/"sudo"/"recipes"/"default.rb").read
59
- assert_equal "recipe \"sudo\"", open(@cookboox_directory/"recipes"/"default.rb").read
60
- end
60
+ def test_compile_the_recipes
61
+ @base.compile_to(@resources[:chef_recipe], test_dir)
62
+ assert_equal open(fixtures_dir/"chef"/"recipes"/"sudo"/"recipes"/"default.rb").read, open(@cookboox_directory/".."/"sudo"/"recipes"/"default.rb").read
63
+ assert_equal "recipe \"sudo\"", open(@cookboox_directory/"recipes"/"default.rb").read
64
+ end
61
65
 
62
- should "compile all the resources when passed the entire array" do
63
- resources = []
64
- resources << @resources[:files]
65
- resources << @resources[:directories]
66
- resources << @resources[:variables]
67
- @base.compile(resources)
68
- ["recipes"/"default.rb", "templates"/"default"/"etc"/"motd.erb"].each do |fi|
69
- assert File.file?(@cookboox_directory/fi)
70
- end
66
+ def test_compile_all_the_resources_when_passed_the_entire_array
67
+ resources = []
68
+ resources << @resources[:files]
69
+ resources << @resources[:directories]
70
+ resources << @resources[:variables]
71
+ @base.compile(resources)
72
+ ["recipes"/"default.rb", "templates"/"default"/"etc"/"motd.erb"].each do |fi|
73
+ assert File.file?(@cookboox_directory/fi)
74
+ end
71
75
 
72
76
  output =<<-EOE
73
77
  template "/etc/motd" do
@@ -91,54 +95,42 @@ EOE
91
95
  assert_equal output, open(@cookboox_directory/"recipes"/"default.rb").read
92
96
  end
93
97
 
94
- context "meta functions" do
95
- setup do
96
- PoolParty::Resource.define_resource_methods
97
- @inst = FakeResource.new
98
- @res = @resources[:link]
99
- @inst.has_service("apache")
100
- end
101
-
102
- should "Add meta notifies on the resource output" do
103
- @res.notifies @inst.get_service("apache"), :reload
104
- assert_match /notifies :reload, resources\(:service => "apache"\)/, @base.compile(@res)
105
- end
106
-
107
- should "Add meta subscribes on the resource output" do
108
- @res.subscribes @inst.get_service("apache"), :reload
109
- assert_match /subscribes :reload, resources\(:service => "apache"\), :delayed/, @base.compile(@res)
110
- end
111
-
112
- should "Add meta ignore_failure on the resource output" do
113
- @res.ignore_failure true
114
- assert_match /ignore_failure true/, @base.compile(@res)
115
- end
116
-
117
- should "Add meta provider on the resource output" do
118
- @res.provider "http://google.com"
119
- assert_match /provider "http:\/\/google\.com"/, @base.compile(@res)
120
- end
121
-
122
- should "Add meta not_if on the resource output" do
123
- @res.not_if "test -f /etc/passwd"
124
- assert_match /not_if "test -f \/etc\/passwd"/, @base.compile(@res)
125
- @res.not_if do
126
- File.file?("/etc/passwd")
127
- end
128
- assert_match /not_if do File.file\?\("\/etc\/passwd"\) end/, @base.compile(@res)
129
- end
130
-
131
- should "Add meta only_if on the resource output" do
132
- @res.only_if "test -f /var/poolparty/tmp"
133
- assert_match /only_if "test -f \/var\/poolparty\/tmp"/, @base.compile(@res)
134
- @res.only_if do
98
+ def test_Add_meta_notifies_on_the_resource_output
99
+ @res.notifies @inst.get_service("apache"), :reload
100
+ assert_match /notifies :reload, resources\(:service => "apache"\)/, @base.compile(@res)
101
+ end
102
+
103
+ def test_Add_meta_subscribes_on_the_resource_output
104
+ @res.subscribes @inst.get_service("apache"), :reload
105
+ assert_match /subscribes :reload, resources\(:service => "apache"\), :delayed/, @base.compile(@res)
106
+ end
107
+
108
+ def test_Add_meta_ignore_failure_on_the_resource_output
109
+ @res.ignore_failure true
110
+ assert_match /ignore_failure true/, @base.compile(@res)
111
+ end
112
+
113
+ def test_Add_meta_provider_on_the_resource_output
114
+ @res.provider "http://google.com"
115
+ assert_match /provider "http:\/\/google\.com"/, @base.compile(@res)
116
+ end
117
+
118
+ def test_Add_meta_not_if_on_the_resource_output
119
+ @res.not_if "test -f /etc/passwd"
120
+ assert_match /not_if "test -f \/etc\/passwd"/, @base.compile(@res)
121
+ @res.not_if do
135
122
  File.file?("/etc/passwd")
136
- end
137
- assert_match /only_if do File.file\?\("\/etc\/passwd"\) end/, @base.compile(@res)
138
- end
139
-
140
123
  end
124
+ assert_match /not_if do File.file\?\("\/etc\/passwd"\) end/, @base.compile(@res)
125
+ end
141
126
 
127
+ def test_add_meta_only_if_on_the_resource_output
128
+ @res.only_if "test -f /var/poolparty/tmp"
129
+ assert_match /only_if "test -f \/var\/poolparty\/tmp"/, @base.compile(@res)
130
+ @res.only_if do
131
+ File.file?("/etc/passwd")
132
+ end
133
+ assert_match /only_if do File.file\?\("\/etc\/passwd"\) end/, @base.compile(@res)
142
134
  end
143
135
 
144
136
  end
@@ -1,5 +1,7 @@
1
1
  require "#{File.dirname(__FILE__)}/../../test_helper"
2
2
 
3
+ include_fixture_resources
4
+
3
5
  class BaseTestClass < PoolParty::Base
4
6
  default_options :a => "a", :d => "dump"
5
7
  end
@@ -31,4 +33,15 @@ class BaseTest < Test::Unit::TestCase
31
33
  assert_equal GRATR::Digraph, inst.resources_graph.class
32
34
  end
33
35
 
36
+ def test_instantiation
37
+ PoolParty::Resource.define_resource_methods
38
+ assert_equal "string_name", FakeResource.new.has_tester("string_name").name
39
+ assert_equal "opts_name", FakeResource.new.has_tester(:name => "opts_name").name
40
+ i = FakeResource.new
41
+ i.has_tester do
42
+ self.name "block_name"
43
+ end
44
+ assert_equal "block_name", i.testers.first.name
45
+ end
46
+
34
47
  end
@@ -97,8 +97,9 @@ class CloudTest < Test::Unit::TestCase
97
97
  end
98
98
 
99
99
  def test_run
100
- result = clouds['app'].run('uptime')
101
- assert_match /uptime/, result["app"]
100
+ # WHAT?
101
+ # result = clouds['app'].run('uptime')
102
+ # assert_match /uptime/, result["app"]
102
103
  end
103
104
 
104
105
  def test_os
@@ -120,6 +121,36 @@ class CloudTest < Test::Unit::TestCase
120
121
  # assert_equal size-1, clouds['app'].nodes.size
121
122
  end
122
123
 
124
+ def test_change_ssh_port
125
+ clear!
126
+ pool "ssh_port" do
127
+ cloud "babity" do
128
+ ssh_port 1922
129
+ end
130
+ cloud "noneity" do
131
+ end
132
+ end
133
+ assert_equal 1922, clouds["babity"].ssh_port
134
+ assert_equal 22, clouds["noneity"].ssh_port
135
+ end
136
+
137
+
138
+ def test_children_getting_parent_options
139
+ clear!
140
+ pool "outside" do
141
+ minimum_instances 1
142
+ maximum_instances 10
143
+ cloud "inside" do
144
+ maximum_instances 100
145
+ end
146
+ end
147
+
148
+ assert_equal 1, pools["outside"].minimum_instances
149
+ assert_equal 10, pools["outside"].maximum_instances
150
+ assert_equal 100, clouds["inside"].maximum_instances
151
+ assert_equal 1, clouds["inside"].minimum_instances
152
+ end
153
+
123
154
  def test_monitor_dsl
124
155
  clear!
125
156
  pool "monitoring" do
@@ -136,4 +167,21 @@ class CloudTest < Test::Unit::TestCase
136
167
  assert_equal({:configure => []}, clouds["monitor_app"].run_monitor("cpu", "0.1"))
137
168
  assert_equal({:vote_for => [:expand]}, clouds["monitor_app"].run_monitor("cpu", "1.4"))
138
169
  end
170
+
171
+ def test_add_monitoring_stack_if_needed
172
+ clear!
173
+ pool "monitoring2" do
174
+ cloud "app_cloud" do
175
+ keypair "test_key"
176
+ platform :ubuntu
177
+ monitor "cpu-idle" do |c|
178
+ vote_for(:expand) if c > 0.8
179
+ end
180
+ end
181
+ end
182
+
183
+ assert_equal 1, clouds["app_cloud"].monitors.size
184
+
185
+ clouds["app_cloud"].compile
186
+ end
139
187
  end
@@ -3,14 +3,14 @@ require "#{File.dirname(__FILE__)}/../../test_helper"
3
3
  class MonitorTest < Test::Unit::TestCase
4
4
 
5
5
  def setup
6
- @mon = PoolParty::Monitor.new(:cpu) do |c|
6
+ @mon = PoolParty::Monitor.new(:'cpu-idle') do |c|
7
7
  vote_for(:expand) if c > 0.8
8
8
  configure if c < 0.1
9
9
  end
10
10
  end
11
11
 
12
12
  def test_monitor_initialize
13
- assert_equal @mon.name, :cpu
13
+ assert_equal @mon.name, :'cpu-idle'
14
14
  assert_equal Proc, @mon.monitor_block.class
15
15
  end
16
16
 
@@ -48,6 +48,11 @@ class ResourceTest < Test::Unit::TestCase
48
48
  assert_equal "real", parent.testers[1].name
49
49
  end
50
50
 
51
+ def test_does_not_have_a_resource_call
52
+ o = @inst.does_not_have_tester "bob"
53
+ assert !@inst.testers.last.exists?
54
+ end
55
+
51
56
  context "print_to methods" do
52
57
  setup do
53
58
  @inst = FakeResource.new
@@ -11,10 +11,10 @@ class LineResourceTest < Test::Unit::TestCase
11
11
  @base.compile_directory = test_dir
12
12
  end
13
13
 
14
- should "have the method denoted by has_method_name" do
15
- assert_match %r{# line in file: /etc/poolparty\n}, @res.compile(:chef)
14
+ should "have the method denoted by has_method_name (no output by :no_print)" do
15
+ assert_nil @res.compile(:chef)
16
16
  end
17
-
17
+
18
18
  end
19
19
 
20
20
  end
@@ -18,7 +18,7 @@ class ServiceResourceTest < Test::Unit::TestCase
18
18
  str = <<-EOS
19
19
  service "example_service" do
20
20
  pattern "example_service"
21
- action :[ :enable, :start ]
21
+ action [ :enable, :start ]
22
22
  supports :reload => true
23
23
  end
24
24
  EOS
@@ -1,20 +1,43 @@
1
1
  require "#{File.dirname(__FILE__)}/../../../test_helper"
2
2
 
3
+ include_chef_only_resources
3
4
  include_fixture_resources
4
5
 
5
6
  class VariableResourceTest < Test::Unit::TestCase
6
- context "Base" do
7
- setup do
8
- PoolParty::Resource.define_resource_methods
9
- @res = PoolParty::Resources::Variable.new "files", ["a_file", "b_file"]
10
- @base = DependencyResolvers::Chef
11
- end
7
+
8
+ def setup
9
+ PoolParty::Resource.define_resource_methods
10
+ @res = PoolParty::Resources::Variable.new "files", ["a_file", "b_file"]
11
+ @base = DependencyResolvers::Chef
12
12
 
13
- should "add the name and value as options on the variable instance" do
14
- assert_equal @res.name, "files"
15
- assert_equal @res.value, ["a_file", "b_file"]
16
- end
13
+ FileUtils.rm_rf test_dir
17
14
 
15
+ @comp_dir = test_dir/"tests"/"something"/"new"
16
+ @attribute_filepath = @comp_dir/"cookbooks"/"poolparty"/"attributes"/"poolparty.rb"
17
+ end
18
+
19
+ def test_add_the_name_and_value_as_options_on_the_variable_instance
20
+ assert_equal @res.name, "files"
21
+ assert_equal @res.value, ["a_file", "b_file"]
18
22
  end
19
23
 
24
+ def test_handle_printing_from_chef_all_sorts_of_fun_variables
25
+ vars = [
26
+ PoolParty::Resources::Variable.new(:the_animal, "Duck"),
27
+ PoolParty::Resources::Variable.new(:hash, {:b => "b"}),
28
+ PoolParty::Resources::Variable.new(:array, [:a, :b, :c, "d"]),
29
+ PoolParty::Resources::Variable.new(:symbol, :d),
30
+ ]
31
+
32
+ FileUtils.rm(@attribute_filepath) if File.file?(@attribute_filepath)
33
+
34
+ @base.compile_to(vars, @comp_dir)
35
+ cont = open(@attribute_filepath).read
36
+
37
+ assert_match /poolparty\[:the_animal\] = "Duck"/, cont
38
+ assert_match /poolparty\[:hash\] = \{:b => "b"\}/, cont
39
+ assert_match /poolparty\[:array\] = \[ :a, :b, :c, "d" \]/, cont
40
+ assert_match /poolparty\[:symbol\] = :d/, cont
41
+ end
42
+
20
43
  end
@@ -0,0 +1,127 @@
1
+ === 2.0.11 / 24 Feb 2009
2
+
3
+ * Add :key_data option for specifying raw private keys in PEM format [Alex Holems, Andrew Babkin]
4
+
5
+
6
+ === 2.0.10 / 4 Feb 2009
7
+
8
+ * Added Net::SSH.configuration_for to make it easier to query the SSH configuration file(s) [Jamis Buck]
9
+
10
+
11
+ === 2.0.9 / 1 Feb 2009
12
+
13
+ * Specifying non-nil user argument overrides user in .ssh/config [Jamis Buck]
14
+
15
+ * Ignore requests for non-existent channels (workaround ssh server bug) [Jamis Buck]
16
+
17
+ * Add terminate! method for hard shutdown scenarios [Jamis Buck]
18
+
19
+ * Revert to pre-2.0.7 key-loading behavior by default, but load private-key if public-key doesn't exist [Jamis Buck]
20
+
21
+ * Make sure :passphrase option gets passed to key manager [Bob Cotton]
22
+
23
+
24
+ === 2.0.8 / 29 December 2008
25
+
26
+ * Fix private key change from 2.0.7 so that keys are loaded just-in-time, avoiding unecessary prompts from encrypted keys. [Jamis Buck]
27
+
28
+
29
+ === 2.0.7 / 29 December 2008
30
+
31
+ * Make key manager use private keys instead of requiring public key to exist [arilerner@mac.com]
32
+
33
+ * Fix failing tests [arilerner@mac.com]
34
+
35
+ * Don't include pageant when running under JRuby [Angel N. Sciortino]
36
+
37
+
38
+ === 2.0.6 / 6 December 2008
39
+
40
+ * Update the Manifest file so that the gem includes all necessary files [Jamis Buck]
41
+
42
+
43
+ === 2.0.5 / 6 December 2008
44
+
45
+ * Make the Pageant interface comply with more of the Socket interface to avoid related errors [Jamis Buck]
46
+
47
+ * Don't busy-wait on session close for remaining channels to close [Will Bryant]
48
+
49
+ * Ruby 1.9 compatibility [Jamis Buck]
50
+
51
+ * Fix Cipher#final to correctly flag a need for a cipher reset [Jamis Buck]
52
+
53
+
54
+ === 2.0.4 / 27 Aug 2008
55
+
56
+ * Added Connection::Session#closed? and Transport::Session#closed? [Jamis Buck]
57
+
58
+ * Numeric host names in .ssh/config are now parsed correct [Yanko Ivanov]
59
+
60
+ * Make sure the error raised when a public key file is malformed is more informative than a MethodMissing error [Jamis Buck]
61
+
62
+ * Cipher#reset is now called after Cipher#final, with the last n bytes used as the next initialization vector [Jamis Buck]
63
+
64
+
65
+ === 2.0.3 / 27 Jun 2008
66
+
67
+ * Make Net::SSH::Version comparable [Brian Candler]
68
+
69
+ * Fix errors in port forwarding when a channel could not be opened due to a typo in the exception name [Matthew Todd]
70
+
71
+ * Use #chomp instead of #strip when cleaning the version string reported by the remote host, so that trailing whitespace is preserved (this is to play nice with servers like Mocana SSH) [Timo Gatsonides]
72
+
73
+ * Correctly parse ssh_config entries with eq-sign delimiters [Jamis Buck]
74
+
75
+ * Ignore malformed ssh_config entries [Jamis Buck]
76
+
77
+ === 2.0.2 / 29 May 2008
78
+
79
+ * Make sure the agent client understands both RSA "identities answers" [Jamis Buck]
80
+
81
+ * Fixed key truncation bug that caused hmacs other than SHA1 to fail with "corrupt hmac" errors [Jamis Buck]
82
+
83
+ * Fix detection and loading of public keys when the keys don't actually exist [David Dollar]
84
+
85
+
86
+ === 2.0.1 / 5 May 2008
87
+
88
+ * Teach Net::SSH about a handful of default key names [Jamis Buck]
89
+
90
+
91
+ === 2.0.0 / 1 May 2008
92
+
93
+ * Allow the :verbose argument to accept symbols (:debug, etc.) as well as Logger level constants (Logger::DEBUG, etc.) [Jamis Buck]
94
+
95
+
96
+ === 2.0 Preview Release 4 (1.99.3) / 19 Apr 2008
97
+
98
+ * Make sure HOME is set to something sane, even on OS's that don't set it by default [Jamis Buck]
99
+
100
+ * Add a :passphrase option to specify the passphrase to use with private keys [Francis Sullivan]
101
+
102
+ * Open a new auth agent connection for every auth-agent channel request [Jamis Buck]
103
+
104
+
105
+ === 2.0 Preview Release 3 (1.99.2) / 10 Apr 2008
106
+
107
+ * Session properties [Jamis Buck]
108
+
109
+ * Make channel open failure work with a callback so that failures can be handled similarly to successes [Jamis Buck]
110
+
111
+
112
+ === 2.0 Preview Release 2 (1.99.1) / 22 Mar 2008
113
+
114
+ * Partial support for ~/.ssh/config (and related) SSH configuration files [Daniel J. Berger, Jamis Buck]
115
+
116
+ * Added Net::SSH::Test to facilitate testing complex SSH state machines [Jamis Buck]
117
+
118
+ * Reworked Net::SSH::Prompt to use conditionally-selected modules [Jamis Buck, suggested by James Rosen]
119
+
120
+ * Added Channel#eof? and Channel#eof! [Jamis Buck]
121
+
122
+ * Fixed bug in strict host key verifier on cache miss [Mike Timm]
123
+
124
+
125
+ === 2.0 Preview Release 1 (1.99.0) / 21 Aug 2007
126
+
127
+ * First preview release of Net::SSH v2
@@ -0,0 +1,104 @@
1
+ CHANGELOG.rdoc
2
+ lib/net/ssh/authentication/agent.rb
3
+ lib/net/ssh/authentication/constants.rb
4
+ lib/net/ssh/authentication/key_manager.rb
5
+ lib/net/ssh/authentication/methods/abstract.rb
6
+ lib/net/ssh/authentication/methods/hostbased.rb
7
+ lib/net/ssh/authentication/methods/keyboard_interactive.rb
8
+ lib/net/ssh/authentication/methods/password.rb
9
+ lib/net/ssh/authentication/methods/publickey.rb
10
+ lib/net/ssh/authentication/pageant.rb
11
+ lib/net/ssh/authentication/session.rb
12
+ lib/net/ssh/buffer.rb
13
+ lib/net/ssh/buffered_io.rb
14
+ lib/net/ssh/config.rb
15
+ lib/net/ssh/connection/channel.rb
16
+ lib/net/ssh/connection/constants.rb
17
+ lib/net/ssh/connection/session.rb
18
+ lib/net/ssh/connection/term.rb
19
+ lib/net/ssh/errors.rb
20
+ lib/net/ssh/key_factory.rb
21
+ lib/net/ssh/known_hosts.rb
22
+ lib/net/ssh/loggable.rb
23
+ lib/net/ssh/packet.rb
24
+ lib/net/ssh/prompt.rb
25
+ lib/net/ssh/proxy/errors.rb
26
+ lib/net/ssh/proxy/http.rb
27
+ lib/net/ssh/proxy/socks4.rb
28
+ lib/net/ssh/proxy/socks5.rb
29
+ lib/net/ssh/ruby_compat.rb
30
+ lib/net/ssh/service/forward.rb
31
+ lib/net/ssh/test/channel.rb
32
+ lib/net/ssh/test/extensions.rb
33
+ lib/net/ssh/test/kex.rb
34
+ lib/net/ssh/test/local_packet.rb
35
+ lib/net/ssh/test/packet.rb
36
+ lib/net/ssh/test/remote_packet.rb
37
+ lib/net/ssh/test/script.rb
38
+ lib/net/ssh/test/socket.rb
39
+ lib/net/ssh/test.rb
40
+ lib/net/ssh/transport/algorithms.rb
41
+ lib/net/ssh/transport/cipher_factory.rb
42
+ lib/net/ssh/transport/constants.rb
43
+ lib/net/ssh/transport/hmac/abstract.rb
44
+ lib/net/ssh/transport/hmac/md5.rb
45
+ lib/net/ssh/transport/hmac/md5_96.rb
46
+ lib/net/ssh/transport/hmac/none.rb
47
+ lib/net/ssh/transport/hmac/sha1.rb
48
+ lib/net/ssh/transport/hmac/sha1_96.rb
49
+ lib/net/ssh/transport/hmac.rb
50
+ lib/net/ssh/transport/identity_cipher.rb
51
+ lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
52
+ lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb
53
+ lib/net/ssh/transport/kex.rb
54
+ lib/net/ssh/transport/openssl.rb
55
+ lib/net/ssh/transport/packet_stream.rb
56
+ lib/net/ssh/transport/server_version.rb
57
+ lib/net/ssh/transport/session.rb
58
+ lib/net/ssh/transport/state.rb
59
+ lib/net/ssh/verifiers/lenient.rb
60
+ lib/net/ssh/verifiers/null.rb
61
+ lib/net/ssh/verifiers/strict.rb
62
+ lib/net/ssh/version.rb
63
+ lib/net/ssh.rb
64
+ Manifest
65
+ net-ssh.gemspec
66
+ Rakefile
67
+ README.rdoc
68
+ setup.rb
69
+ test/authentication/methods/common.rb
70
+ test/authentication/methods/test_abstract.rb
71
+ test/authentication/methods/test_hostbased.rb
72
+ test/authentication/methods/test_keyboard_interactive.rb
73
+ test/authentication/methods/test_password.rb
74
+ test/authentication/methods/test_publickey.rb
75
+ test/authentication/test_agent.rb
76
+ test/authentication/test_key_manager.rb
77
+ test/authentication/test_session.rb
78
+ test/common.rb
79
+ test/configs/eqsign
80
+ test/configs/exact_match
81
+ test/configs/wild_cards
82
+ test/connection/test_channel.rb
83
+ test/connection/test_session.rb
84
+ test/test_all.rb
85
+ test/test_buffer.rb
86
+ test/test_buffered_io.rb
87
+ test/test_config.rb
88
+ test/test_key_factory.rb
89
+ test/transport/hmac/test_md5.rb
90
+ test/transport/hmac/test_md5_96.rb
91
+ test/transport/hmac/test_none.rb
92
+ test/transport/hmac/test_sha1.rb
93
+ test/transport/hmac/test_sha1_96.rb
94
+ test/transport/kex/test_diffie_hellman_group1_sha1.rb
95
+ test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
96
+ test/transport/test_algorithms.rb
97
+ test/transport/test_cipher_factory.rb
98
+ test/transport/test_hmac.rb
99
+ test/transport/test_identity_cipher.rb
100
+ test/transport/test_packet_stream.rb
101
+ test/transport/test_server_version.rb
102
+ test/transport/test_session.rb
103
+ test/transport/test_state.rb
104
+ THANKS.rdoc