vagrant-routes 0.0.4 → 0.0.5
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/lib/command.rb +24 -2
- data/vagrant-routes.gemspec +1 -1
- 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: 668e55f34bb0b358ede506fcd4e334f540f84867
|
4
|
+
data.tar.gz: c5188e6ee78caa70495e8878f3ceb31237858eae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b286cad39e271e03e858b8d21e356d94b8f842e9817e32206e90255de2204e0b4c7ddd3ca6df09f7e232ac7f5f40abd7a6281dbe2aedffca0694c2ab39a3ed8
|
7
|
+
data.tar.gz: 9eaf4085453e970265b9b67df66908dca0e7b55d12197b92e7746afa3fa97683248778b5a5923bea28c6d9a090e5879d6f62c10eb8be0d482f55676d9d455cd9
|
data/lib/command.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
1
3
|
module VagrantPlugins
|
2
4
|
module Routes
|
3
5
|
# Issue when `oc get routes` returns empty responce
|
@@ -9,8 +11,25 @@ module VagrantPlugins
|
|
9
11
|
end
|
10
12
|
|
11
13
|
def execute
|
14
|
+
options = {}
|
15
|
+
options[:all] = ''
|
16
|
+
|
17
|
+
opts = OptionParser.new do |o|
|
18
|
+
o.banner = 'Usage: vagrant route [options]'
|
19
|
+
o.separator ''
|
20
|
+
o.separator 'Options:'
|
21
|
+
o.separator ''
|
22
|
+
|
23
|
+
o.on('--all', 'Expose all routes (you need to be cluster admin)') do
|
24
|
+
options[:all] = '--all-namespaces'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
argv = parse_options(opts)
|
29
|
+
return unless argv
|
30
|
+
|
12
31
|
with_target_vms(nil, single_target: true) do |machine|
|
13
|
-
machine.communicate.execute(
|
32
|
+
machine.communicate.execute("oc get routes #{options[:all]}", sudo: false) do |type, data|
|
14
33
|
@result = data
|
15
34
|
end
|
16
35
|
@env.ui.info("Updating hosts file with new hostnames:\n#{routes_hostnames(@result).join(', ')}")
|
@@ -27,8 +46,11 @@ module VagrantPlugins
|
|
27
46
|
# OpenShift is not installed on the guest
|
28
47
|
when /.*oc: command not found.*/
|
29
48
|
@env.ui.error('oc command was not found on guest. Is OpenShift installed?')
|
49
|
+
# Logged-in user has no privilage to list all routes
|
50
|
+
when /.*cannot list all routes in the cluster*/
|
51
|
+
@env.ui.error('You need to be logged in as cluster admin to expose all routes.')
|
30
52
|
else
|
31
|
-
@env.ui.error("Unexpected error occured:\n#{e.message}")
|
53
|
+
@env.ui.error("Unexpected error occured:\n\n#{e.message}")
|
32
54
|
end
|
33
55
|
end
|
34
56
|
|
data/vagrant-routes.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josef Strzibny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|