vagrant-routes 0.0.6 → 0.0.7

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: b3984bfea6cf8f234255b04f5f0f4c1b80410c16
4
- data.tar.gz: 6ff71bd408ae115eb397fe4a7769055f6e70b970
3
+ metadata.gz: 6b15859c8c928b2fd8ff7d89b5b743a157a15f8f
4
+ data.tar.gz: ed730704062afde83b619f030ce013c773d36d6f
5
5
  SHA512:
6
- metadata.gz: aab4aa5519b026f3603ad8a9f0b4dea1085f4c9c63d1067d3874f124d5e3b2b7942f98a7cbb9edabacca534cd3159eb25478482ef9c39695208e29018f47b869
7
- data.tar.gz: 988e4bfb269436d09af38e35fda7ced8211484a105047222324c9aa58e4d022ebfb139877b16e19f5d9e0747f4bf71168968205ccb7bad0170aae25b03fd96ff
6
+ metadata.gz: f729e7605064a371ad383578a4526ff275307d52a7c5cfde29457e92bd7763e09e35751aa31606513962bb9fc2749382d085cb14bd0ab021c9df756d25a113ab
7
+ data.tar.gz: 37d7f5482e0f62b5b58e8aae7276dc88b478564412711ebe27e5b3d5710108d3f11ab8eb329f6dcfcf23982baa11f9650eb8b4d41a08bc89df60f76259455da9
data/README.md CHANGED
@@ -16,15 +16,17 @@ $ vagrant plugin install vagrant-routes
16
16
 
17
17
  ## Usage
18
18
 
19
- - First start Vagrant VM with OpenShift, log in and select your project within the guest
20
- - Then run `vagrant route`
19
+ Export all routes as cluster admin:
21
20
 
22
21
  ```
23
- $ vagrant route
22
+ $ vagrant route --all
24
23
  Updating hosts file with new hostnames:
25
24
  pyapp-python.router.default.svc.cluster.local
26
25
  ```
27
26
 
27
+ Otherwise you need to log in and select your project within the OpenShift guest and then run `vagrant route` on host.
28
+
29
+
28
30
  Use `--help` to see all options:
29
31
 
30
32
  ```
@@ -33,6 +35,6 @@ Usage: vagrant route [options]
33
35
 
34
36
  Options:
35
37
 
36
- --all Expose all routes (you need to be cluster admin)
38
+ --all Expose all routes
37
39
  -h, --help Print this help
38
40
  ```
data/lib/command.rb CHANGED
@@ -33,9 +33,9 @@ module VagrantPlugins
33
33
  machine.communicate.execute("oc get routes #{options[:all]}", sudo: false) do |type, data|
34
34
  @result = data
35
35
  end
36
- @env.ui.info("Updating hosts file with new hostnames:\n#{routes_hostnames(@result).join(', ')}")
36
+ @env.ui.info("Updating hosts file with new hostnames:\n#{routes_hostnames(@result, options).join(', ')}")
37
37
  ip = machine.ssh_info[:host]
38
- update_hosts(routes_hostnames(@result), ip)
38
+ update_hosts(routes_hostnames(@result, options), ip)
39
39
  end
40
40
  rescue NoRoutesError
41
41
  @env.ui.error('No routes are defined.')
@@ -95,12 +95,22 @@ module VagrantPlugins
95
95
  # NAME HOST/PORT PATH SERVICE LABELS INSECURE POLICY TLS TERMINATION
96
96
  # ruby20 ruby20-ruby-app.router.default.svc.cluster.local ruby20 app=ruby20
97
97
  # pyapp pyapp-python.router.default.svc.cluster.local pyapp app=pyapp
98
- def routes_hostnames(output)
98
+ #
99
+ # With --all-namespaces option this includes namespace field:
100
+ #
101
+ # NAMESPACE NAME HOST/PORT PATH SERVICE LABELS INSECURE POLICY TLS TERMINATION
102
+ # test ruby22app ruby22app-test.router.default.svc.cluster.local ruby22app app=ruby22app
103
+ #
104
+ def routes_hostnames(output, options)
99
105
  fail NoRoutesError unless output
100
106
  lines = output.split("\n")[1..-1]
101
107
  hostnames = []
102
108
  lines.each do |line|
103
- hostnames << line.split[1]
109
+ if options[:all]
110
+ hostnames << line.split[2]
111
+ else
112
+ hostnames << line.split[1]
113
+ end
104
114
  end
105
115
  fail NoRoutesError if hostnames.empty?
106
116
  hostnames
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'vagrant-routes'
3
- spec.version = '0.0.6'
3
+ spec.version = '0.0.7'
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.6
4
+ version: 0.0.7
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-12-01 00:00:00.000000000 Z
11
+ date: 2015-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler