comrad 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/comrad.gemspec +1 -1
- data/lib/chef.rb +5 -4
- data/lib/config.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66c6919f9e828f044c58110f1f249c397bf8b30f
|
4
|
+
data.tar.gz: bfe6cea60a7b4284a42f4cfff6e46684da3520ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a3c112332856871089428d59ea4ad98f0ba0f8c5b7e155552c8854961e74b62849a3d66f0e59f88c207b1083565f6252c989854b2d5f91bbc230b9d039dd715
|
7
|
+
data.tar.gz: 2b8c623f22b0d0ea2fd7ac9611a5c2625bb6f7612d1cb8632d0320006fc68d9937f4ea3c93a8bb2aafedb79cac9d908f7dbe250ac0d62f23e5b204ec43bd0d36
|
data/comrad.gemspec
CHANGED
data/lib/chef.rb
CHANGED
@@ -31,6 +31,7 @@ module Comrad
|
|
31
31
|
@slack = Comrad::Slack.new(config)
|
32
32
|
end
|
33
33
|
|
34
|
+
# builds a string of what the action is / would be depending on dry run or not
|
34
35
|
def action_string(action, trailing_text)
|
35
36
|
string = @config['flags']['dryrun'] ? " - I would #{action} " : " - #{action.capitalize.chomp('e')}ing "
|
36
37
|
string + trailing_text
|
@@ -45,20 +46,20 @@ module Comrad
|
|
45
46
|
elsif type == 'cookbooks'
|
46
47
|
"knife cookbook #{action == 'update' ? 'upload' : 'delete'} #{item1}"
|
47
48
|
else
|
48
|
-
"knife #{type.chomp('s')} from file #{type}
|
49
|
+
"knife #{type.chomp('s')} from file #{type}/#{item1}"
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
53
|
# run the provided knife command
|
53
54
|
def excute_knife_cmd(cmd)
|
54
55
|
if @config['flags']['dryrun']
|
55
|
-
|
56
|
-
|
56
|
+
@slack.slack_put(" - I would be running #{cmd}")
|
57
|
+
else
|
57
58
|
@slack.slack_put(' - Non-dry mode is not implemented. Doing nothing')
|
58
59
|
end
|
59
60
|
end
|
60
61
|
|
61
|
-
#
|
62
|
+
# main method of the class. Iterates over the changes passed in and kicks off actions / slack messaging
|
62
63
|
def take_actions
|
63
64
|
@changes.each_pair do |type, name|
|
64
65
|
next if name.empty?
|
data/lib/config.rb
CHANGED
@@ -33,8 +33,18 @@ module Comrad
|
|
33
33
|
@settings = merge_configs
|
34
34
|
end
|
35
35
|
|
36
|
+
# make sure the BUILD_NUMBER Jenkins variable exists. If not force help
|
37
|
+
def check_jenkins_env_variable
|
38
|
+
if ENV['BUILD_NUMBER'].nil?
|
39
|
+
puts "Jenkins set BUILD_NUMBER environmental variable not set. Cannot continue.\n\n"
|
40
|
+
ARGV[0] = '-h'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
36
44
|
# grabs the flags passed in via command line
|
37
45
|
def parse_flags
|
46
|
+
check_jenkins_env_variable
|
47
|
+
|
38
48
|
flags = { config: '/etc/comrad.yml', print_config: false, quiet: false }
|
39
49
|
OptionParser.new do |opts|
|
40
50
|
opts.banner = 'Usage: comrad [options]'
|
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.0.
|
4
|
+
version: 0.0.3
|
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-04-
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|