ranch-hand 0.6.0 → 0.7.0
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/Changelog.md +4 -0
- data/README.md +1 -1
- data/bin/ranch-hand +2 -2
- data/lib/ranch_hand/kube_ctl.rb +14 -13
- data/lib/ranch_hand/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 739b914a9a3aaa61cbd1ea414310158a5de894f02f93028c6c6927d3dcf4d567
|
4
|
+
data.tar.gz: 0166cfe7b29ad795d8f8ee3e0bef4a91bb3fce4e55e2a662ab24e7cf06474596
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0608be5112035aa5f4ca5e9e7ce1fc570763f485d688541de6c9095bcd3345cf0ce69378c820f60b782f0051b88322e4f7c052960f75db9c18ddffd3be44dc8
|
7
|
+
data.tar.gz: 957785da2e00ac1fb0834a9cb9cec97a6ed7628d1c0ad02e458ab1da3fdf76625801b733c1d4439a58ab8d1437d7ab6b3ce80ad09978a4d79417e1e39ff86f72
|
data/Changelog.md
ADDED
data/README.md
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Provides a simple interface on top the Rancher CLI and the Kubectl commands to make running commands in pods easier.
|
6
6
|
This is particularily useful when using Kubernetes in a development environment.
|
7
7
|
|
8
|
-

|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
data/bin/ranch-hand
CHANGED
@@ -14,7 +14,7 @@ module RanchHandCLI
|
|
14
14
|
version RanchHand::VERSION
|
15
15
|
|
16
16
|
subcommand_option_handling :normal
|
17
|
-
arguments :
|
17
|
+
arguments :loose
|
18
18
|
|
19
19
|
desc 'Sets up ranch hand'
|
20
20
|
command :setup do |c|
|
@@ -44,7 +44,7 @@ module RanchHandCLI
|
|
44
44
|
c.flag [:p, :pod], default_value: config[:pod], desc: "Run command in a specific pod. If used with -g only the pod name can be specified and the command will be run against the first in the group"
|
45
45
|
|
46
46
|
c.action do |global_options, command_options, args|
|
47
|
-
RanchHand::KubeCtl.new.exec(
|
47
|
+
RanchHand::KubeCtl.new.exec(args: args, cmd_options: command_options)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
data/lib/ranch_hand/kube_ctl.rb
CHANGED
@@ -2,26 +2,25 @@ module RanchHand
|
|
2
2
|
class KubeCtl
|
3
3
|
include RanchHand::Commands
|
4
4
|
|
5
|
-
def exec(
|
6
|
-
|
7
|
-
# options = project_config.merge(options)
|
5
|
+
def exec(args: [], cmd_options: {})
|
6
|
+
args = Array(args)
|
8
7
|
|
9
|
-
namespace =
|
8
|
+
namespace = cmd_options.delete(:namespace)
|
10
9
|
|
11
|
-
if
|
10
|
+
if cmd_options[:remove]
|
12
11
|
remove_command(namespace)
|
13
|
-
elsif
|
12
|
+
elsif cmd_options[:repeat]
|
14
13
|
repeat_command(namespace)
|
15
|
-
elsif
|
16
|
-
pod = select_pod(namespace,
|
17
|
-
run_command(namespace, pod,
|
14
|
+
elsif cmd_options[:command]
|
15
|
+
pod = select_pod(namespace, cmd_options)
|
16
|
+
run_command(namespace, pod, cmd_options[:command], args)
|
18
17
|
else
|
19
|
-
choose_command(namespace,
|
18
|
+
choose_command(namespace, cmd_options)
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
|
-
def run_command(namespace, pod, cmd)
|
24
|
-
system("rancher kubectl -n #{namespace} exec -it #{pod} -- #{cmd}")
|
22
|
+
def run_command(namespace, pod, cmd, args=[])
|
23
|
+
system("rancher kubectl -n #{namespace} exec -it #{pod} -- #{cmd} #{args.join(' ')}".strip)
|
25
24
|
end
|
26
25
|
|
27
26
|
def choose_command(namespace, options={})
|
@@ -176,7 +175,9 @@ module RanchHand
|
|
176
175
|
|
177
176
|
def pods(namespace)
|
178
177
|
pods_cmd = "rancher kubectl -n #{namespace} get po"
|
179
|
-
command(printer: :null).run(pods_cmd).out.split("\n")[1..-1]
|
178
|
+
pods = command(printer: :null).run(pods_cmd).out.split("\n")[1..-1]&.map{|l| l.split(/\s+/)[0]}
|
179
|
+
|
180
|
+
pods || []
|
180
181
|
end
|
181
182
|
|
182
183
|
def storage
|
data/lib/ranch_hand/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ranch-hand
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peregrinator
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- ".rspec"
|
121
121
|
- ".travis.yml"
|
122
122
|
- CODE_OF_CONDUCT.md
|
123
|
+
- Changelog.md
|
123
124
|
- Gemfile
|
124
125
|
- LICENSE.txt
|
125
126
|
- README.md
|