loom-core 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/.rspec +2 -0
  4. data/Gemfile +4 -0
  5. data/Gemfile.lock +99 -0
  6. data/Guardfile +54 -0
  7. data/Rakefile +6 -0
  8. data/bin/loom +185 -0
  9. data/lib/env/development.rb +1 -0
  10. data/lib/loom.rb +44 -0
  11. data/lib/loom/all.rb +20 -0
  12. data/lib/loom/config.rb +106 -0
  13. data/lib/loom/core_ext.rb +37 -0
  14. data/lib/loom/dsl.rb +60 -0
  15. data/lib/loom/facts.rb +13 -0
  16. data/lib/loom/facts/all.rb +2 -0
  17. data/lib/loom/facts/fact_file_provider.rb +86 -0
  18. data/lib/loom/facts/fact_set.rb +138 -0
  19. data/lib/loom/host_spec.rb +32 -0
  20. data/lib/loom/inventory.rb +124 -0
  21. data/lib/loom/logger.rb +141 -0
  22. data/lib/loom/method_signature.rb +174 -0
  23. data/lib/loom/mods.rb +4 -0
  24. data/lib/loom/mods/action_proxy.rb +105 -0
  25. data/lib/loom/mods/all.rb +3 -0
  26. data/lib/loom/mods/mod_loader.rb +80 -0
  27. data/lib/loom/mods/module.rb +113 -0
  28. data/lib/loom/pattern.rb +15 -0
  29. data/lib/loom/pattern/all.rb +7 -0
  30. data/lib/loom/pattern/definition_context.rb +74 -0
  31. data/lib/loom/pattern/dsl.rb +176 -0
  32. data/lib/loom/pattern/hook.rb +28 -0
  33. data/lib/loom/pattern/loader.rb +48 -0
  34. data/lib/loom/pattern/reference.rb +71 -0
  35. data/lib/loom/pattern/reference_set.rb +169 -0
  36. data/lib/loom/pattern/result_reporter.rb +77 -0
  37. data/lib/loom/runner.rb +209 -0
  38. data/lib/loom/shell.rb +12 -0
  39. data/lib/loom/shell/all.rb +10 -0
  40. data/lib/loom/shell/api.rb +48 -0
  41. data/lib/loom/shell/cmd_result.rb +33 -0
  42. data/lib/loom/shell/cmd_wrapper.rb +164 -0
  43. data/lib/loom/shell/core.rb +226 -0
  44. data/lib/loom/shell/harness_blob.rb +26 -0
  45. data/lib/loom/shell/harness_command_builder.rb +50 -0
  46. data/lib/loom/shell/session.rb +25 -0
  47. data/lib/loom/trap.rb +44 -0
  48. data/lib/loom/version.rb +3 -0
  49. data/lib/loomext/all.rb +4 -0
  50. data/lib/loomext/corefacts.rb +6 -0
  51. data/lib/loomext/corefacts/all.rb +8 -0
  52. data/lib/loomext/corefacts/facter_provider.rb +24 -0
  53. data/lib/loomext/coremods.rb +5 -0
  54. data/lib/loomext/coremods/all.rb +13 -0
  55. data/lib/loomext/coremods/exec.rb +50 -0
  56. data/lib/loomext/coremods/files.rb +104 -0
  57. data/lib/loomext/coremods/net.rb +33 -0
  58. data/lib/loomext/coremods/package/adapter.rb +100 -0
  59. data/lib/loomext/coremods/package/package.rb +62 -0
  60. data/lib/loomext/coremods/user.rb +82 -0
  61. data/lib/loomext/coremods/vm.rb +0 -0
  62. data/lib/loomext/coremods/vm/all.rb +6 -0
  63. data/lib/loomext/coremods/vm/vbox.rb +84 -0
  64. data/loom.gemspec +39 -0
  65. data/loom/inventory.yml +13 -0
  66. data/scripts/harness.sh +242 -0
  67. data/spec/loom/host_spec_spec.rb +101 -0
  68. data/spec/loom/inventory_spec.rb +154 -0
  69. data/spec/loom/method_signature_spec.rb +275 -0
  70. data/spec/loom/pattern/dsl_spec.rb +207 -0
  71. data/spec/loom/shell/cmd_wrapper_spec.rb +239 -0
  72. data/spec/loom/shell/harness_blob_spec.rb +42 -0
  73. data/spec/loom/shell/harness_command_builder_spec.rb +36 -0
  74. data/spec/runloom.sh +35 -0
  75. data/spec/scripts/harness_spec.rb +385 -0
  76. data/spec/spec_helper.rb +94 -0
  77. data/spec/test.loom +370 -0
  78. data/spec/test_loom_spec.rb +57 -0
  79. metadata +287 -0
@@ -0,0 +1,57 @@
1
+ require 'open3'
2
+
3
+ # TODO: fix this test to run the runloom.sh script. Currently running
4
+ # the loom script in a child process from ruby runs without a
5
+ # TTY. This causes the sshkit/net:ssh connection to connect abnormally
6
+ # (don't know why). The script does not use ssh keys and instead uses
7
+ # password auth to ssh, at which point the script halts waiting for
8
+ # input. Running w/ sshkit debugging reveals some of the issue. See
9
+ # this stack:
10
+
11
+ # [I] executing patterns ["fail"] across hosts ["vm-ubuntu-db"]
12
+ # INFO [7befb8a7] Running which facter on vm-ubuntu-db
13
+ # DEBUG [7befb8a7] Command: which facter
14
+ # erick@192.168.56.101's password: stty: 'standard input': Inappropriate ioctl for device
15
+ # stty: 'standard input': Inappropriate ioctl for device
16
+ # stty: 'standard input': Inappropriate ioctl for device
17
+
18
+ # erick@192.168.56.101's password: stty: 'standard input': Inappropriate ioctl for device
19
+ # stty: 'standard input': Inappropriate ioctl for device
20
+ # stty: 'standard input': Inappropriate ioctl for device
21
+
22
+ # erick@192.168.56.101's password: stty: 'standard input': Inappropriate ioctl for device
23
+ # stty: 'standard input': Inappropriate ioctl for device
24
+ # stty: 'standard input': Inappropriate ioctl for device
25
+
26
+ # [F] fatal error => #<Net::SSH::AuthenticationFailed: Authentication failed for user erick@192.168.56.101>
27
+ # [F] /home/erick/.gem/ruby/gems/net-ssh-3.2.0/lib/net/ssh.rb:249:in `start'
28
+ # /home/erick/.gem/ruby/gems/sshkit-1.11.3/lib/sshkit/backends/connection_pool.rb:59:in `call'
29
+ # /home/erick/.gem/ruby/gems/sshkit-1.11.3/lib/sshkit/backends/connection_pool.rb:59:in `with'
30
+ # /home/erick/.gem/ruby/gems/sshkit-1.11.3/lib/sshkit/backends/netssh.rb:155:in `with_ssh'
31
+ # /home/erick/.gem/ruby/gems/sshkit-1.11.3/lib/sshkit/backends/netssh.rb:108:in `execute_command'
32
+ # /home/erick/.gem/ruby/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:141:in `block in create_command_and_execute'
33
+ # /home/erick/.gem/ruby/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:141:in `tap'
34
+ # /home/erick/.gem/ruby/gems/sshkit-1.11.3/lib/sshkit/backends/abstract.rb:141:in `create_command_and_execute'
35
+ # /home/erick/workspace/src/loom/lib/loom/shell.rb:91:in `execute'
36
+
37
+ describe "spec/test.loom file" do
38
+
39
+ let(:runloom) { File.join File.dirname(__FILE__), 'runloom.sh' }
40
+
41
+ it "executes successfully" do
42
+ exit_status = nil
43
+ `#{runloom}`
44
+ # Open3.popen3(runloom) do |stdin,stdout,stderr,wait_thred|
45
+ # puts "running #{runloom}"
46
+ # while line=stderr.gets do
47
+ # puts line
48
+ # end
49
+ #
50
+ # exit_status = wait_thred.value
51
+ # end
52
+
53
+ puts "exit status: #{$?.exitstatus}"
54
+
55
+ expect($?.exitstatus).to eq 0
56
+ end
57
+ end
metadata ADDED
@@ -0,0 +1,287 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: loom-core
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Erick Johnson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sshkit
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: commander
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: net-ssh
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rbnacl-libsodium
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.10
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.10
69
+ - !ruby/object:Gem::Dependency
70
+ name: bcrypt_pbkdf
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.0.alpha1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 1.0.0.alpha1
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.13'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.13'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '11.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '11.3'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.5'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.5'
125
+ - !ruby/object:Gem::Dependency
126
+ name: guard-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '4.7'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '4.7'
139
+ - !ruby/object:Gem::Dependency
140
+ name: pry
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.10'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.10'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry-byebug
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Repeatable management of remote hosts over SSH
168
+ email: ejohnson82@gmail.com
169
+ executables:
170
+ - loom
171
+ extensions: []
172
+ extra_rdoc_files: []
173
+ files:
174
+ - ".gitignore"
175
+ - ".rspec"
176
+ - Gemfile
177
+ - Gemfile.lock
178
+ - Guardfile
179
+ - Rakefile
180
+ - bin/loom
181
+ - lib/env/development.rb
182
+ - lib/loom.rb
183
+ - lib/loom/all.rb
184
+ - lib/loom/config.rb
185
+ - lib/loom/core_ext.rb
186
+ - lib/loom/dsl.rb
187
+ - lib/loom/facts.rb
188
+ - lib/loom/facts/all.rb
189
+ - lib/loom/facts/fact_file_provider.rb
190
+ - lib/loom/facts/fact_set.rb
191
+ - lib/loom/host_spec.rb
192
+ - lib/loom/inventory.rb
193
+ - lib/loom/logger.rb
194
+ - lib/loom/method_signature.rb
195
+ - lib/loom/mods.rb
196
+ - lib/loom/mods/action_proxy.rb
197
+ - lib/loom/mods/all.rb
198
+ - lib/loom/mods/mod_loader.rb
199
+ - lib/loom/mods/module.rb
200
+ - lib/loom/pattern.rb
201
+ - lib/loom/pattern/all.rb
202
+ - lib/loom/pattern/definition_context.rb
203
+ - lib/loom/pattern/dsl.rb
204
+ - lib/loom/pattern/hook.rb
205
+ - lib/loom/pattern/loader.rb
206
+ - lib/loom/pattern/reference.rb
207
+ - lib/loom/pattern/reference_set.rb
208
+ - lib/loom/pattern/result_reporter.rb
209
+ - lib/loom/runner.rb
210
+ - lib/loom/shell.rb
211
+ - lib/loom/shell/all.rb
212
+ - lib/loom/shell/api.rb
213
+ - lib/loom/shell/cmd_result.rb
214
+ - lib/loom/shell/cmd_wrapper.rb
215
+ - lib/loom/shell/core.rb
216
+ - lib/loom/shell/harness_blob.rb
217
+ - lib/loom/shell/harness_command_builder.rb
218
+ - lib/loom/shell/session.rb
219
+ - lib/loom/trap.rb
220
+ - lib/loom/version.rb
221
+ - lib/loomext/all.rb
222
+ - lib/loomext/corefacts.rb
223
+ - lib/loomext/corefacts/all.rb
224
+ - lib/loomext/corefacts/facter_provider.rb
225
+ - lib/loomext/coremods.rb
226
+ - lib/loomext/coremods/all.rb
227
+ - lib/loomext/coremods/exec.rb
228
+ - lib/loomext/coremods/files.rb
229
+ - lib/loomext/coremods/net.rb
230
+ - lib/loomext/coremods/package/adapter.rb
231
+ - lib/loomext/coremods/package/package.rb
232
+ - lib/loomext/coremods/user.rb
233
+ - lib/loomext/coremods/vm.rb
234
+ - lib/loomext/coremods/vm/all.rb
235
+ - lib/loomext/coremods/vm/vbox.rb
236
+ - loom.gemspec
237
+ - loom/inventory.yml
238
+ - scripts/harness.sh
239
+ - spec/loom/host_spec_spec.rb
240
+ - spec/loom/inventory_spec.rb
241
+ - spec/loom/method_signature_spec.rb
242
+ - spec/loom/pattern/dsl_spec.rb
243
+ - spec/loom/shell/cmd_wrapper_spec.rb
244
+ - spec/loom/shell/harness_blob_spec.rb
245
+ - spec/loom/shell/harness_command_builder_spec.rb
246
+ - spec/runloom.sh
247
+ - spec/scripts/harness_spec.rb
248
+ - spec/spec_helper.rb
249
+ - spec/test.loom
250
+ - spec/test_loom_spec.rb
251
+ homepage:
252
+ licenses:
253
+ - MIT
254
+ metadata: {}
255
+ post_install_message:
256
+ rdoc_options: []
257
+ require_paths:
258
+ - lib
259
+ required_ruby_version: !ruby/object:Gem::Requirement
260
+ requirements:
261
+ - - ">="
262
+ - !ruby/object:Gem::Version
263
+ version: '0'
264
+ required_rubygems_version: !ruby/object:Gem::Requirement
265
+ requirements:
266
+ - - ">="
267
+ - !ruby/object:Gem::Version
268
+ version: '0'
269
+ requirements: []
270
+ rubyforge_project:
271
+ rubygems_version: 2.7.6
272
+ signing_key:
273
+ specification_version: 4
274
+ summary: Repeatable management of remote hosts over SSH
275
+ test_files:
276
+ - spec/loom/host_spec_spec.rb
277
+ - spec/loom/inventory_spec.rb
278
+ - spec/loom/method_signature_spec.rb
279
+ - spec/loom/pattern/dsl_spec.rb
280
+ - spec/loom/shell/cmd_wrapper_spec.rb
281
+ - spec/loom/shell/harness_blob_spec.rb
282
+ - spec/loom/shell/harness_command_builder_spec.rb
283
+ - spec/runloom.sh
284
+ - spec/scripts/harness_spec.rb
285
+ - spec/spec_helper.rb
286
+ - spec/test.loom
287
+ - spec/test_loom_spec.rb