apprentice 0.0.3 → 0.0.4

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: b5f4b1b516cc0c10479dacd023f4a34cd11e808e
4
- data.tar.gz: f1d981a651b0c191e14aa0f63fb43d0ea721437f
3
+ metadata.gz: 5152f8fabc39fa41e7582c9bbf869103a9961dd9
4
+ data.tar.gz: 348c014c2b49f8f57f28566674a9ea5b3b4a8333
5
5
  SHA512:
6
- metadata.gz: 545bf87fdce666c2704c41bf4637223d4806970784dba4124f94b5cf401ea2eca953653eb2379aa03c33826a7570111f695c4b2f1065b0afaa6725f9b0518f0e
7
- data.tar.gz: 1a590f6d6a9776081835a3317ebb20123a6b6dfa1912df2d6acf07211408af3e1e66a3fa29e212ac76b86f908a6012f821719343746a801402afa09d2a824b9c
6
+ metadata.gz: 00f42b4557f9e01afc6196acbdad7d6ba21a5864e80f6a20e31f79ebbd19d488599168e28aa08a9f9f647f1d77d1583245a1c3c175d9360dd5bdb7f2fd8bf89e
7
+ data.tar.gz: 285fd021b9acb529fceae9d5626078040505660ba1503891bfd9a7244efc021cd55115ac9429e51bab397132818e06249c5ec78e783cf1dda7cb8038b680b533
data/README.md CHANGED
@@ -48,7 +48,14 @@ By itself, Apprentice doesn't do aynthing all that useful. However, it accommoda
48
48
 
49
49
  ## Goodies
50
50
 
51
- I've included an (untested) init.d script which you may use in order to start Apprentice at boot time.
51
+ ### Init-script
52
+ I've included an init.d script, `ruby-apprentice.init` which you may use in order to start Apprentice at boot time. The init-script needs a file named `ruby-apprentice` inside the directory `/etc/defaults/`. An example file is included with the repository, aptly named `ruby-apprentice.default`.
53
+
54
+ $ mv ruby-apprentice.init /etc/init.d/ruby-apprentice
55
+ $ chmod +x /etc/init.d/ruby-apprentice
56
+ $ mv ruby-apprentice.defaults /etc/defaults/
57
+
58
+ Now you just need to add the relevant information for starting Apprentice. The defaults file is pretty self explanatory.
52
59
 
53
60
  ## TODO
54
61
 
@@ -1,12 +1,20 @@
1
1
  module Galera
2
2
  def get_galera_status
3
3
  begin
4
- result = @client.query "SHOW STATUS LIKE 'wsrep_%';"
4
+ client = Mysql2::Client.new(
5
+ host: @server,
6
+ port: @sql_port,
7
+ username: @user,
8
+ password: @password,
9
+ as: :array
10
+ )
11
+ result = client.query "SHOW STATUS LIKE 'wsrep_%';"
5
12
  if result.count > 0
6
13
  result.each do |r|
7
14
  @status.merge!(Hash[*r])
8
15
  end
9
16
  end
17
+ client.close
10
18
  rescue Exception => message
11
19
  puts message
12
20
  end
@@ -15,20 +15,6 @@ module Server
15
15
  @password = options.password
16
16
  @donor_allowed = options.donor_allowed
17
17
  @status = {}
18
-
19
- begin
20
- @client = Mysql2::Client.new(
21
- host: @server,
22
- port: @sql_port,
23
- username: @user,
24
- password: @password,
25
- as: :array,
26
- reconnect: true
27
- )
28
- rescue Exception => message
29
- puts message
30
- EM.stop_server
31
- end
32
18
  end
33
19
 
34
20
  def receive_data(data)
@@ -1,3 +1,3 @@
1
1
  module Apprentice
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apprentice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moritz Heiber