knife-cssh 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +24 -0
- data/lib/chef/knife/cssh-summon.rb +35 -0
- data/lib/knife-cssh.rb +3 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b75656ede8c6472b81c390adcd7dbb30e5a587fe
|
4
|
+
data.tar.gz: 95698d86e540563eaab5d69d30430454cb775e42
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 572f2bd3d0509286abc3d1ec1f7a5cd5bb9ff84e3fd8326d857d81d44ab75b033b663889c5c7fb8e013bd1b535462a6d5f2cf336eee9fab7ce9471786007276f
|
7
|
+
data.tar.gz: a1076952adf9013a75bfa3a8ee3169bb2608fb7e4bf877dd7aeeac25783af740ebfc7469dfaab8f732b4532b0a92671bb653fe8ef9dda6be821ae35e6063d53a
|
data/README.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Knife cssh
|
2
|
+
===========
|
3
|
+
|
4
|
+
How to use
|
5
|
+
----------
|
6
|
+
|
7
|
+
It's easy as pie :
|
8
|
+
|
9
|
+
cssh all the machines with the postgresql recipe ?
|
10
|
+
|
11
|
+
```knife cssh summon recipes:postgresql```
|
12
|
+
|
13
|
+
cssh ALL THE THINGS !!!
|
14
|
+
|
15
|
+
```knife cssh summon fqdn:*```
|
16
|
+
|
17
|
+
License
|
18
|
+
-------
|
19
|
+
3 clauses BSD
|
20
|
+
|
21
|
+
Author
|
22
|
+
------
|
23
|
+
|
24
|
+
Nicolas Szalay : < nicolas.szalay _at_ fotolia _dot_ com >
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'chef/knife'
|
2
|
+
|
3
|
+
module KnifeCssh
|
4
|
+
class CsshSummon < Chef::Knife
|
5
|
+
|
6
|
+
banner "knife cssh summon QUERY"
|
7
|
+
|
8
|
+
deps do
|
9
|
+
require 'chef/node'
|
10
|
+
require 'chef/environment'
|
11
|
+
require 'chef/api_client'
|
12
|
+
require 'chef/knife/search'
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
# this chef is mainly from chef own knife search command
|
17
|
+
query = name_args[0]
|
18
|
+
q = Chef::Search::Query.new
|
19
|
+
escaped_query = URI.escape(query, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
|
20
|
+
result_items = []
|
21
|
+
|
22
|
+
begin
|
23
|
+
q.search('node', escaped_query, 'X_CHEF_id_CHEF_X asc', 0, 100) do |item|
|
24
|
+
result_items.push(item["fqdn"]) if item.has_key?("fqdn")
|
25
|
+
end
|
26
|
+
rescue Net::HTTPServerException => e
|
27
|
+
msg = Chef::JSONCompat.from_json(e.response.body)["error"].first
|
28
|
+
ui.error("search failed: #{msg}")
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
|
32
|
+
%x[cssh #{result_items.join(" ")}]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/knife-cssh.rb
ADDED
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: knife-cssh
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicolas Szalay
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-05 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Summon cssh from a chef search
|
14
|
+
email: nico@rottenbytes.info
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- README.md
|
20
|
+
- lib/chef/knife/cssh-summon.rb
|
21
|
+
- lib/knife-cssh.rb
|
22
|
+
homepage: http://www.rottenbytes.info
|
23
|
+
licenses:
|
24
|
+
- 3 clauses BSD
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.2.2
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Knife cssh plugin
|
46
|
+
test_files: []
|