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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57564926862bf99c5d4aa62b9ad7b91710eab321
4
- data.tar.gz: 887f8cd0dbc8e0da576942e32165eea298a60284
3
+ metadata.gz: 668e55f34bb0b358ede506fcd4e334f540f84867
4
+ data.tar.gz: c5188e6ee78caa70495e8878f3ceb31237858eae
5
5
  SHA512:
6
- metadata.gz: 35f0bedb54c65e388b1fbf0418abbe2e9234cbfe83d715025ad8ad6915ebb94d717fccbb7cee1a11bdca8c48b9f351ecd4225d4dac53a65a77532d01b6998923
7
- data.tar.gz: b37d4cdcb9407d0ebc383f5fe853bff5cfb58fd20ab9957ec1423f7ff2c9f427770e0f6a3fc9a0db6001c599f159a733dede19720dd217c2e21d681d53f1ed9a
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('oc get routes', sudo: false) do |type, data|
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
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'vagrant-routes'
3
- spec.version = '0.0.4'
3
+ spec.version = '0.0.5'
4
4
  spec.homepage = 'https://github.com/strzibny/vagrant-routes'
5
5
  spec.summary = 'Access OpenShift routes on the host'
6
6
 
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
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-18 00:00:00.000000000 Z
11
+ date: 2015-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler