varnish_rest_api 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/bin/varnishrestapi.rb +0 -0
- data/lib/varnish_rest_api.rb +1 -0
- data/lib/varnish_rest_api/varnish_base.rb +7 -4
- data/lib/varnish_rest_api/version.rb +1 -1
- metadata +4 -5
- data/Gemfile.lock +0 -58
- data/Gemfile.orig +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc483ffa3d099a1aaa36e97a531166ce2cca5d89
|
4
|
+
data.tar.gz: 4e5058f0d5d020039359d9b652a7b5da90df14bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0516cd42b16afb7b3edcdccb272809d14f0501f79ece82bbc54ad0406f6cd21b4d670c6c8195a52834e761a90d33ff68783c6365fd1e9c31da333ba69b4530d
|
7
|
+
data.tar.gz: dbb0bc09595e5bbae8018a74c80a490f706959adbed6f6d99d6cca3745c6178cbf788aa8f06d9ca682f18708a7a33551e7bcecfffcd866d8d9fa32c81a959322
|
data/.gitignore
CHANGED
data/bin/varnishrestapi.rb
CHANGED
File without changes
|
data/lib/varnish_rest_api.rb
CHANGED
@@ -46,6 +46,7 @@ config_default = {
|
|
46
46
|
config = config_default.merge!(config_file)
|
47
47
|
|
48
48
|
varnish = VarnishBase.new(:instance => config[:instance], \
|
49
|
+
:port => config[:port], \
|
49
50
|
:zookeeper_host => config[:zookeeper_host], \
|
50
51
|
:use_zookeeper => config[:use_zookeeper], \
|
51
52
|
:zookeeper_basenode => config[:zookeeper_basenode], \
|
@@ -5,11 +5,11 @@ require 'ostruct'
|
|
5
5
|
require 'zk'
|
6
6
|
require 'socket'
|
7
7
|
|
8
|
-
|
9
8
|
class VarnishBase
|
10
9
|
|
11
10
|
def initialize(params = {})
|
12
11
|
@mgmt_port = params.fetch(:mgmt_port, 6082)
|
12
|
+
@port = params.fetch(:port, 4567)
|
13
13
|
@mgmt_host = params.fetch(:mgmt_host, 'localhost')
|
14
14
|
@instance = params.fetch(:instance, 'default')
|
15
15
|
@use_zookeeper = params.fetch(:use_zookeeper, false)
|
@@ -30,10 +30,13 @@ class VarnishBase
|
|
30
30
|
abort "problem connecting to zookeeper host: #{@zookeeper_host}"
|
31
31
|
end
|
32
32
|
|
33
|
-
begin
|
34
|
-
@
|
33
|
+
begin
|
34
|
+
node = @zookeeper_basenode + '/' + @hostname
|
35
|
+
# if the node exists, delete it since it is probably not from our zk session
|
36
|
+
@zk.delete(node,:ignore => [:no_node,:not_empty,:bad_version])
|
37
|
+
@zk.create(node,"#{@hostname}:#{@port}", :mode => :ephemeral_sequential, :ignore => [:no_node,:not_empty,:bad_version])
|
35
38
|
rescue ZK::Exceptions::NoNode => zke
|
36
|
-
|
39
|
+
$stderr.puts "something went wrong creating the zookeeper node #{node}: " + zke.message
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: varnish_rest_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Colby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
@@ -106,8 +106,6 @@ files:
|
|
106
106
|
- ".buildpath"
|
107
107
|
- ".gitignore"
|
108
108
|
- Gemfile
|
109
|
-
- Gemfile.lock
|
110
|
-
- Gemfile.orig
|
111
109
|
- LICENSE.txt
|
112
110
|
- README.md
|
113
111
|
- Rakefile
|
@@ -140,8 +138,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
138
|
version: '0'
|
141
139
|
requirements: []
|
142
140
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.4.
|
141
|
+
rubygems_version: 2.4.5
|
144
142
|
signing_key:
|
145
143
|
specification_version: 4
|
146
144
|
summary: A sinatra rest api for varnish.
|
147
145
|
test_files: []
|
146
|
+
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
celluloid (0.16.0)
|
5
|
-
timers (~> 4.0.0)
|
6
|
-
daemons (1.2.2)
|
7
|
-
eventmachine (1.0.7)
|
8
|
-
ffi (1.9.8)
|
9
|
-
hitimes (1.2.2)
|
10
|
-
json (1.8.2)
|
11
|
-
listen (2.9.0)
|
12
|
-
celluloid (>= 0.15.2)
|
13
|
-
rb-fsevent (>= 0.9.3)
|
14
|
-
rb-inotify (>= 0.9)
|
15
|
-
little-plugger (1.1.3)
|
16
|
-
logging (1.8.2)
|
17
|
-
little-plugger (>= 1.1.3)
|
18
|
-
multi_json (>= 1.8.4)
|
19
|
-
mime-types (2.4.3)
|
20
|
-
multi_json (1.11.0)
|
21
|
-
netrc (0.10.3)
|
22
|
-
rack (1.6.0)
|
23
|
-
rack-protection (1.5.3)
|
24
|
-
rack
|
25
|
-
rb-fsevent (0.9.4)
|
26
|
-
rb-inotify (0.9.5)
|
27
|
-
ffi (>= 0.5.0)
|
28
|
-
rerun (0.10.0)
|
29
|
-
listen (~> 2.7, >= 2.7.3)
|
30
|
-
rest-client (1.7.3)
|
31
|
-
mime-types (>= 1.16, < 3.0)
|
32
|
-
netrc (~> 0.7)
|
33
|
-
sinatra (1.4.5)
|
34
|
-
rack (~> 1.4)
|
35
|
-
rack-protection (~> 1.4)
|
36
|
-
tilt (~> 1.3, >= 1.3.4)
|
37
|
-
thin (1.6.3)
|
38
|
-
daemons (~> 1.0, >= 1.0.9)
|
39
|
-
eventmachine (~> 1.0)
|
40
|
-
rack (~> 1.0)
|
41
|
-
tilt (1.4.1)
|
42
|
-
timers (4.0.1)
|
43
|
-
hitimes
|
44
|
-
zk (1.9.5)
|
45
|
-
logging (~> 1.8.2)
|
46
|
-
zookeeper (~> 1.4.0)
|
47
|
-
zookeeper (1.4.10)
|
48
|
-
|
49
|
-
PLATFORMS
|
50
|
-
ruby
|
51
|
-
|
52
|
-
DEPENDENCIES
|
53
|
-
json
|
54
|
-
rerun
|
55
|
-
rest-client
|
56
|
-
sinatra
|
57
|
-
thin
|
58
|
-
zk
|