admiral-check 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+
4
+ require 'yaml'
5
+ require 'admiral/layer'
6
+
7
+ module Admiral
8
+ module Layers
9
+ class AdmiralTestServerspecInstall < Admiral::LayerBase
10
+ def initialize(config, ipaddress)
11
+ description = "Install serverspec and infraspec"
12
+
13
+ super(description, config, ipaddress)
14
+ end
15
+
16
+ def do_action()
17
+ username = @config['username']
18
+
19
+ gemsdir = "/tmp/#{username}/gems"
20
+ cachedir = "#{gemsdir}/cache"
21
+
22
+ env = {
23
+ 'username' => username,
24
+ 'GEM_HOME' => gemsdir,
25
+ 'GEM_PATH' => gemsdir,
26
+ 'GEM_CACHE' => cachedir,
27
+ }
28
+
29
+ cmd = "/tmp/#{username}/#{$uid}.sh"
30
+
31
+ rc = run_ssh_command(cmd, :allow_proxy => true, :env => env)
32
+ return (rc == 0)
33
+ end
34
+ end
35
+ end
36
+ end
37
+
@@ -0,0 +1,6 @@
1
+ #! /bin/sh
2
+
3
+ mkdir -p "${GEM_CACHE}"
4
+ export GEM_HOME GEM_PATH GEM_CACHE
5
+ /opt/chef/embedded/bin/gem install serverspec specinfra rake --no-rdoc --no-ri
6
+ chown ${username}:${username} -R /tmp/${username}
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+
4
+ require 'yaml'
5
+ require 'admiral/layer'
6
+
7
+ module Admiral
8
+ module Layers
9
+ class AdmiralTestServerspecRun < Admiral::LayerBase
10
+ def initialize(config, ipaddress)
11
+ description = "Run RSpec"
12
+
13
+ super(description, config, ipaddress)
14
+ end
15
+
16
+ def do_action()
17
+ username = @config['username']
18
+
19
+ gemsdir = "/tmp/#{username}/gems"
20
+ cachedir = "#{gemsdir}/cache"
21
+
22
+ env = {
23
+ 'username' => username,
24
+ 'GEM_HOME' => gemsdir,
25
+ 'GEM_PATH' => gemsdir,
26
+ 'GEM_CACHE' => cachedir,
27
+ }
28
+
29
+ cmd = "/tmp/#{username}/#{$uid}.sh"
30
+
31
+ rc = run_ssh_command(cmd, :env => env)
32
+ return (rc == 0)
33
+ end
34
+ end
35
+ end
36
+ end
37
+
@@ -0,0 +1,5 @@
1
+ #! /bin/sh
2
+
3
+ export GEM_HOME GEM_PATH GEM_CACHE
4
+ cd /tmp/${username}/test
5
+ /opt/chef/embedded/bin/rake
@@ -0,0 +1,4 @@
1
+
2
+ --color
3
+ --format documentation
4
+
@@ -0,0 +1,17 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ task :spec => 'spec:default'
5
+ task :default => :spec
6
+
7
+ namespace :spec do
8
+
9
+ task :default => :localhost
10
+
11
+ target = "localhost"
12
+ desc "Run serverspec tests to #{target}"
13
+ RSpec::Core::RakeTask.new(target.to_sym) do |t|
14
+ ENV['TARGET_HOST'] = target
15
+ t.pattern = "spec/*_spec.rb"
16
+ end
17
+ end
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+
4
+ require 'yaml'
5
+ require 'admiral/layer'
6
+
7
+ module Admiral
8
+ module Layers
9
+ class AdmiralTestServerspecUpload < Admiral::LayerBase
10
+ def initialize(config, ipaddress)
11
+ description = "Upload serverspec tests"
12
+
13
+ super(description, config, ipaddress)
14
+ end
15
+
16
+ def do_action()
17
+ username = @config['username']
18
+
19
+ remote_test_dir = "/tmp/#{username}/test"
20
+ remote_spec_dir = "/tmp/#{username}/test/spec"
21
+
22
+ local_test_dir = "#{$location}/#{$uid}.d"
23
+ local_spec_dir = "test"
24
+
25
+ upload(local_test_dir, remote_test_dir)
26
+ upload(local_spec_dir, remote_spec_dir)
27
+
28
+ return true
29
+ end
30
+ end
31
+ end
32
+ end
33
+
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+
4
+ require 'mixlib/shellout'
5
+
6
+ module Admiral
7
+ module Shell
8
+ def self.local(cmd, options={}, live = false)
9
+ sh = Mixlib::ShellOut.new(cmd, options)
10
+
11
+ if live
12
+ sh.live_stdout = STDOUT
13
+ end
14
+
15
+ sh.run_command
16
+ if sh.error?
17
+ puts "Failed to run #{cmd}"
18
+ puts sh.stderr
19
+ return nil
20
+ else
21
+ return sh.stdout
22
+ end
23
+ end
24
+
25
+ def self.remote (host, username, keyfile, cmd)
26
+ Kernel.exec("ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no #{username}@#{host} -i #{keyfile}")
27
+ end
28
+ end
29
+ end
30
+
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2014, Sean Porter
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ module Admiral
18
+ ADMIRAL__VERSION = "0.0.1"
19
+ end
metadata ADDED
@@ -0,0 +1,187 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: admiral-check
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Gattsu
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-07-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: mixlib-shellout
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.6.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 1.6.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: net-scp
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.1'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.1'
46
+ - !ruby/object:Gem::Dependency
47
+ name: net-ssh
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.7'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.7'
62
+ - !ruby/object:Gem::Dependency
63
+ name: safe_yaml
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: thor
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: '0.18'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '0.18'
94
+ - !ruby/object:Gem::Dependency
95
+ name: bundler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '1.3'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.3'
110
+ - !ruby/object:Gem::Dependency
111
+ name: rake
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: Deployment and testing tool
127
+ email:
128
+ - gattsu.blackswordsman@gmail.com
129
+ executables:
130
+ - admiral
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - CHANGELOG.md
135
+ - Gemfile
136
+ - LICENSE
137
+ - README.md
138
+ - Rakefile
139
+ - admiral-check.gemspec
140
+ - bin/admiral
141
+ - lib/admiral/config.rb
142
+ - lib/admiral/core.rb
143
+ - lib/admiral/docker.rb
144
+ - lib/admiral/layer.rb
145
+ - lib/admiral/layers/admiral.build.sh.rb
146
+ - lib/admiral/layers/admiral.exemple.test.rb
147
+ - lib/admiral/layers/admiral.puppet.apply.rb
148
+ - lib/admiral/layers/admiral.svn.proxy.rb
149
+ - lib/admiral/layers/admiral.svn.proxy.sh
150
+ - lib/admiral/layers/admiral.svn.puppet.cookbook.rb
151
+ - lib/admiral/layers/admiral.svn.puppet.manifest.rb
152
+ - lib/admiral/layers/admiral.test.chef.install.rb
153
+ - lib/admiral/layers/admiral.test.serverspec.install.rb
154
+ - lib/admiral/layers/admiral.test.serverspec.install.sh
155
+ - lib/admiral/layers/admiral.test.serverspec.run.rb
156
+ - lib/admiral/layers/admiral.test.serverspec.run.sh
157
+ - lib/admiral/layers/admiral.test.serverspec.upload.d/.rspec
158
+ - lib/admiral/layers/admiral.test.serverspec.upload.d/Rakefile
159
+ - lib/admiral/layers/admiral.test.serverspec.upload.rb
160
+ - lib/admiral/shell.rb
161
+ - lib/admiral/version.rb
162
+ homepage: https://github.com/gattsublackswordsman/admiral-check
163
+ licenses:
164
+ - Apache 2.0
165
+ post_install_message:
166
+ rdoc_options: []
167
+ require_paths:
168
+ - lib
169
+ required_ruby_version: !ruby/object:Gem::Requirement
170
+ none: false
171
+ requirements:
172
+ - - ! '>='
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ required_rubygems_version: !ruby/object:Gem::Requirement
176
+ none: false
177
+ requirements:
178
+ - - ! '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ requirements: []
182
+ rubyforge_project:
183
+ rubygems_version: 1.8.23
184
+ signing_key:
185
+ specification_version: 3
186
+ summary: Deployment and testing tool
187
+ test_files: []