comrad 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -1
- data/comrad.gemspec +3 -3
- data/lib/comrad.rb +1 -3
- data/lib/comrad/chef.rb +21 -5
- data/lib/comrad/config.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2926a0719cb7f9bd18f2524c428aaf197d5511f9
|
4
|
+
data.tar.gz: 6abec92ec8804e07c3442480bde7328128c5f1e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 742c737000629566f0f19e25d2e31edf4735daec6c1911e607f580996003e71be6d00a30b84c56556a0bd28641c28fe82dacce3ad3ad9e1bbdb835c3292c115a
|
7
|
+
data.tar.gz: 05999c5cabf106dd56f267db5c7aa7f949921203a062167063c55e5eafb72ad660b2cbec93620e42e3603e48a17593959af0ffca88a50dc9f9733bdf4db3c619
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/comrad.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'comrad'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.2.0'
|
4
4
|
s.date = Date.today.to_s
|
5
5
|
s.platform = Gem::Platform::RUBY
|
6
6
|
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
@@ -14,9 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.required_ruby_version = '>= 1.9.3'
|
15
15
|
s.add_dependency 'rest-client', '~> 1.7.0'
|
16
16
|
s.add_dependency 'chef', '>= 11.0'
|
17
|
-
s.add_dependency 'slack-post', '~> 0.3', '>= 0.3.
|
17
|
+
s.add_dependency 'slack-post', '~> 0.3', '>= 0.3.2'
|
18
18
|
s.add_development_dependency 'rake', '~> 10.0'
|
19
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
19
|
+
s.add_development_dependency 'rubocop', '~> 0.33.0'
|
20
20
|
|
21
21
|
s.files = `git ls-files -z`.split("\x0")
|
22
22
|
s.executables = s.name
|
data/lib/comrad.rb
CHANGED
@@ -15,8 +15,6 @@
|
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
|
-
require 'pp'
|
19
|
-
|
20
18
|
require 'core_ext/string'
|
21
19
|
|
22
20
|
require 'comrad/config'
|
@@ -44,7 +42,7 @@ module Comrad
|
|
44
42
|
end
|
45
43
|
|
46
44
|
'The following chef objects will be changed'.marquee
|
47
|
-
|
45
|
+
puts Changeset.changes.to_yaml.gsub("---\n", '')
|
48
46
|
|
49
47
|
'Making Chef Changes'.marquee
|
50
48
|
Chef.process_changes
|
data/lib/comrad/chef.rb
CHANGED
@@ -42,12 +42,28 @@ module Comrad
|
|
42
42
|
]
|
43
43
|
end
|
44
44
|
|
45
|
-
#
|
46
|
-
def self::
|
45
|
+
# handle the actual shell out
|
46
|
+
def self::shell_out(cmd)
|
47
|
+
require 'open3'
|
48
|
+
puts "Running #{cmd}..."
|
49
|
+
Open3.popen3(cmd) do |_stdin, _stdout, stderr, thread|
|
50
|
+
unless thread.value.success?
|
51
|
+
puts 'Failed to run the knife command with the following error:'.to_red
|
52
|
+
puts stderr.read
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# determine if we should shell out or print and then do it
|
58
|
+
def self::execute_knife_cmd(cmd)
|
59
|
+
# dry mode will just show what we would do
|
47
60
|
if Config.config['flags']['dryrun']
|
48
61
|
puts "I would be running '#{cmd}'"
|
49
|
-
|
50
|
-
|
62
|
+
# are we in scary mode or not running a delete command
|
63
|
+
elsif Config.config['flags']['scary'] || !cmd.include?('delete')
|
64
|
+
shell_out(cmd)
|
65
|
+
else # we're trying to delete something w/o scary mode enabled
|
66
|
+
puts "#{cmd} skipped. Enable scary-mode to allow deletes."
|
51
67
|
end
|
52
68
|
end
|
53
69
|
|
@@ -56,7 +72,7 @@ module Comrad
|
|
56
72
|
Changeset.changes.each_pair do |item_class, action_pairs|
|
57
73
|
next if action_pairs.empty?
|
58
74
|
action_pairs.each_pair do |item, action|
|
59
|
-
|
75
|
+
execute_knife_cmd(knife_command(item_class, item, action))
|
60
76
|
end
|
61
77
|
end
|
62
78
|
end
|
data/lib/comrad/config.rb
CHANGED
@@ -45,7 +45,7 @@ module Comrad
|
|
45
45
|
# make sure we have a build number
|
46
46
|
def self::validate_config(conf)
|
47
47
|
if conf['buildnum'].nil?
|
48
|
-
puts "Jenkins set BUILD_NUMBER environmental variable not set, and Comrad --
|
48
|
+
puts "Jenkins set BUILD_NUMBER environmental variable not set, and Comrad --build-num CLI flag not used. Cannot continue without a build number.\n\n"
|
49
49
|
exit!
|
50
50
|
end
|
51
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comrad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: '0.3'
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 0.3.
|
50
|
+
version: 0.3.2
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
version: '0.3'
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.3.
|
60
|
+
version: 0.3.2
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rake
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
81
|
+
version: 0.33.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
88
|
+
version: 0.33.0
|
89
89
|
description: Your rad comrade - Sync changes from git to Chef Server via Jenkins
|
90
90
|
email: tim@cozy.co
|
91
91
|
executables:
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.4.
|
139
|
+
rubygems_version: 2.4.8
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Your rad comrade - Sync changes from git to Chef Server via Jenkins
|