stacksondeck 1.1.2 → 1.1.3
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.
- checksums.yaml +4 -4
- data/Readme.md +11 -3
- data/VERSION +1 -1
- data/lib/stacksondeck/app.rb +9 -1
- data/lib/stacksondeck/main.rb +19 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cdff7f13a7e76edb2d9aaf98e8248d40188d6ca
|
4
|
+
data.tar.gz: 52fe4bf51c8ef01486a5a10da059ffc9fc48d50e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a613b9ca2c7c4fe1d677cc1a7994761662dad56ca3cc18e5ea6994e4f3083fbc8b5092284bfc97efec9683a9435b6523d80917d7cebc03f9ac8bc2ed027733a
|
7
|
+
data.tar.gz: 63ccaf3fc121151c742e5e3e5f20cf95f34358c622074a6a9933c457e773f9187e16c5c85eaed0bd7a266c3ac176f86ccfdd8b97a23864dd003911de731747fa
|
data/Readme.md
CHANGED
@@ -8,8 +8,10 @@ Chef server using the provided knife credentials (`--config`); results are cache
|
|
8
8
|
for a configurable amount of time (`--refresh`). You may also wish to override
|
9
9
|
the Rundeck user name to suit your environment (`--username`).
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
SOD merges a Chef node's environments, roles, and tags into Rundeck tags. This
|
12
|
+
behavior is not currently configurable, but you may use the `--tagfile` feature
|
13
|
+
(introduced in v1.1.3) to map node names to a list of additional tags, which
|
14
|
+
will be merged with the information discovered via Chef Search.
|
13
15
|
|
14
16
|
|
15
17
|
## Usage
|
@@ -39,7 +41,8 @@ You're most likely inteterested in the `server` command:
|
|
39
41
|
-u, [--username=USERNAME] # Username value for Rundeck node
|
40
42
|
# Default: ${job.username}
|
41
43
|
-r, [--refresh=N] # Refresh interval in seconds
|
42
|
-
# Default:
|
44
|
+
# Default: 900
|
45
|
+
-t, [--tagfile=TAGFILE] # JSON file with node tags
|
43
46
|
-l, [--log=LOG] # Log to file instead of STDOUT
|
44
47
|
-v, [--debug], [--no-debug] # Enable DEBUG-level logging
|
45
48
|
-z, [--trace], [--no-trace] # Enable TRACE-level logging
|
@@ -82,8 +85,13 @@ Return the application version:
|
|
82
85
|
(Yeah I lied when I said only one endpoint. Sue me.)
|
83
86
|
|
84
87
|
|
88
|
+
|
85
89
|
## Changelog
|
86
90
|
|
91
|
+
#### v1.1.3
|
92
|
+
|
93
|
+
- Added new `tagfile` feature
|
94
|
+
|
87
95
|
#### v1.1.2
|
88
96
|
|
89
97
|
- Allow override of `username` via query parameter
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.3
|
data/lib/stacksondeck/app.rb
CHANGED
@@ -59,10 +59,17 @@ module StacksOnDeck
|
|
59
59
|
def log ; settings.log end
|
60
60
|
|
61
61
|
|
62
|
+
def self.refresh_tagfile!
|
63
|
+
return {} if settings.tagfile.nil?
|
64
|
+
JSON.parse File.read(settings.tagfile)
|
65
|
+
end
|
66
|
+
|
62
67
|
def self.refresh!
|
63
68
|
log.info event: 'refresh!'
|
64
69
|
started = Time.now
|
65
70
|
|
71
|
+
node_tags = refresh_tagfile!
|
72
|
+
|
66
73
|
nodes = @@ridley.partial_search :node, 'name:*', %w[
|
67
74
|
name
|
68
75
|
hostname
|
@@ -89,7 +96,8 @@ module StacksOnDeck
|
|
89
96
|
tags = n.tags || []
|
90
97
|
tags += n.roles || []
|
91
98
|
tags << n.chef_environment
|
92
|
-
tags.
|
99
|
+
tags += node_tags[name] if node_tags.include? name
|
100
|
+
tags = tags.uniq.compact
|
93
101
|
|
94
102
|
next if n.hostname.nil?
|
95
103
|
|
data/lib/stacksondeck/main.rb
CHANGED
@@ -6,6 +6,8 @@ require_relative 'mjolnir'
|
|
6
6
|
require_relative 'metadata'
|
7
7
|
|
8
8
|
|
9
|
+
Thread.abort_on_exception = true
|
10
|
+
|
9
11
|
module StacksOnDeck
|
10
12
|
|
11
13
|
# StacksOnDeck's entrypoint.
|
@@ -23,6 +25,14 @@ module StacksOnDeck
|
|
23
25
|
puts "\n%s\n" % ART
|
24
26
|
end
|
25
27
|
|
28
|
+
SYSTEM_KNIFE = '/etc/chef/knife.rb'
|
29
|
+
USER_KNIFE = File.join(ENV['HOME'] || '', '.chef', 'knife.rb')
|
30
|
+
|
31
|
+
DEFAULT_KNIFE = if File.exist? SYSTEM_KNIFE
|
32
|
+
SYSTEM_KNIFE
|
33
|
+
elsif File.exist? USER_KNIFE
|
34
|
+
USER_KNIFE
|
35
|
+
end
|
26
36
|
|
27
37
|
desc 'server', 'Start application web server'
|
28
38
|
option :bind, \
|
@@ -44,7 +54,8 @@ module StacksOnDeck
|
|
44
54
|
type: :string,
|
45
55
|
aliases: %w[ -c ],
|
46
56
|
desc: 'Location of Chef configuration',
|
47
|
-
default:
|
57
|
+
default: DEFAULT_KNIFE,
|
58
|
+
required: true
|
48
59
|
option :username, \
|
49
60
|
type: :string,
|
50
61
|
aliases: %w[ -u ],
|
@@ -55,6 +66,11 @@ module StacksOnDeck
|
|
55
66
|
aliases: %w[ -r ],
|
56
67
|
desc: 'Refresh interval in seconds',
|
57
68
|
default: 900
|
69
|
+
option :tagfile, \
|
70
|
+
type: :string,
|
71
|
+
aliases: %w[ -t ],
|
72
|
+
desc: 'JSON file with node tags',
|
73
|
+
required: false
|
58
74
|
include_common_options
|
59
75
|
def server
|
60
76
|
App.set :log, log
|
@@ -64,6 +80,7 @@ module StacksOnDeck
|
|
64
80
|
App.set :refresh, options.refresh
|
65
81
|
App.set :username, options.username
|
66
82
|
App.set :environment, options.environment
|
83
|
+
App.set :tagfile, options.tagfile
|
67
84
|
|
68
85
|
if options.debug?
|
69
86
|
App.set :raise_errors, true
|
@@ -72,13 +89,7 @@ module StacksOnDeck
|
|
72
89
|
App.set :logging, ::Logger::DEBUG
|
73
90
|
end
|
74
91
|
|
75
|
-
Celluloid.logger = nil
|
76
|
-
Thread.abort_on_exception = false
|
77
|
-
|
78
|
-
if options.trace?
|
79
|
-
Celluloid.logger = log
|
80
|
-
Thread.abort_on_exception = true
|
81
|
-
end
|
92
|
+
Celluloid.logger = options.trace? ? log : nil
|
82
93
|
|
83
94
|
log.info event: 'server', options: options
|
84
95
|
App.run!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stacksondeck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sean Clemmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.4.5
|
148
|
+
rubygems_version: 2.4.5.1
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Stupid simple Chef-Rundeck integration
|