gestio2masq 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/exe/gestio2masq +8 -2
- data/gestio2masq.gemspec +3 -2
- data/lib/gestio2masq.rb +5 -0
- data/lib/gestio2masq/CHANGELOG +6 -0
- data/lib/gestio2masq/LICENSE.txt +21 -0
- data/lib/gestio2masq/version.rb +3 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dfd30c9c5e99572bd37dc0794a998ba179f0b9d
|
4
|
+
data.tar.gz: fcc607f12edb58b03154303ce321e8ab20547e1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93397dc8926c166729e80814d63eec42139100738431a99c326dec49fab9794a7d7560ce33738219195202bc5fbd64b94bc69ae92a399e626380bbf008223d7d
|
7
|
+
data.tar.gz: 996de291df6f8ee269f843a29c3fd63e471e20e18886d10734a24090cac549c053824e934652f54421b46ac93708cf17c196dd8f9218a31955791b8693ceaa5f
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Gestio2masq
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/gestio2masq.svg)](http://badge.fury.io/rb/gestio2masq)
|
3
3
|
|
4
|
-
gestio2masq generates dnsmasq configuration files from gestioip mysql databases.
|
5
|
-
|
4
|
+
gestio2masq generates [dnsmasq](http://www.thekelleys.org.uk/dnsmasq/doc.html) configuration files from [GestióIP](http://www.gestioip.net/) mysql databases.
|
5
|
+
Or at least, it does this for *me*. YMMV.
|
6
|
+
|
6
7
|
|
7
8
|
|
8
9
|
## Installation & Configuration
|
@@ -116,6 +117,10 @@ dhcp-hostsfile=/etc/dnsmasq-dhcp-hosts.conf
|
|
116
117
|
-e, --help Show this message
|
117
118
|
|
118
119
|
|
120
|
+
## IRC
|
121
|
+
|
122
|
+
**\#gestio2masq** on Freenode
|
123
|
+
|
119
124
|
## Contributing
|
120
125
|
|
121
126
|
1. Fork it ( https://github.com/svdasein/gestio2masq/fork )
|
data/exe/gestio2masq
CHANGED
@@ -3,6 +3,7 @@ require 'mysql2'
|
|
3
3
|
require 'ipaddress'
|
4
4
|
require 'yaml'
|
5
5
|
require 'trollop'
|
6
|
+
require 'gestio2masq'
|
6
7
|
|
7
8
|
defaults = {
|
8
9
|
:config => '/etc/gestio2masq.conf',
|
@@ -13,6 +14,8 @@ defaults = {
|
|
13
14
|
}
|
14
15
|
|
15
16
|
opts = Trollop::options do
|
17
|
+
usage '[options]'
|
18
|
+
version %Q{Version #{Gestio2masq::VERSION}}
|
16
19
|
opt :config, 'Config file path', :short=>'c', :type=>:string
|
17
20
|
opt :destdir, 'Destination dir', :short=>'t', :type=>:string
|
18
21
|
opt :sqlhost, 'Database host', :short=>'h', :type=>:string
|
@@ -27,10 +30,10 @@ config_file = opts[:config]||defaults[:config]
|
|
27
30
|
config = nil
|
28
31
|
if File.exist?(config_file)
|
29
32
|
begin
|
30
|
-
|
33
|
+
config = YAML.load(File.read(config_file))
|
31
34
|
rescue => detail
|
32
35
|
puts detail.backtrace
|
33
|
-
|
36
|
+
puts %Q(Error reading config from file #{config_file})
|
34
37
|
exit(1)
|
35
38
|
end
|
36
39
|
end
|
@@ -71,6 +74,7 @@ nets_extra_data = mysql.query('select custom_net_column_entries.*,custom_net_col
|
|
71
74
|
|
72
75
|
networks = Hash.new
|
73
76
|
networks_data.each { |net|
|
77
|
+
# Merge custom network columns in with "regular" columns
|
74
78
|
nets_extra_data.select { |each| each[:net_id] == net[:red_num] } .each { |entry|
|
75
79
|
net[entry[:name].to_sym] = entry[:entry]
|
76
80
|
}
|
@@ -91,9 +95,11 @@ dhcp_hosts_entries = Array.new
|
|
91
95
|
cnames_entries = Array.new
|
92
96
|
hosts_data.each { |host|
|
93
97
|
host[:ipaddress] = IPAddress::IPv4.parse_u32(host[:ip].to_i)
|
98
|
+
# Merge custom host columns in with "regular" columns
|
94
99
|
hosts_extra_data.select { |each| each[:host_id] == host[:id] } .each { |entry|
|
95
100
|
host[entry[:name].to_sym] = entry[:entry]
|
96
101
|
}
|
102
|
+
# make hosts point to the network they belong to
|
97
103
|
host[:network] = networks[host[:red_num]]
|
98
104
|
if host[:hostname].size > 0
|
99
105
|
if host[:MAC]
|
data/gestio2masq.gemspec
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'gestio2masq/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |spec|
|
6
7
|
spec.name = "gestio2masq"
|
7
|
-
spec.version =
|
8
|
+
spec.version = Gestio2masq::VERSION
|
8
9
|
spec.authors = ["svdasein"]
|
9
10
|
spec.email = ["svdasein@github"]
|
10
11
|
|
@@ -29,7 +30,7 @@ gestioip mysql database.}
|
|
29
30
|
|
30
31
|
spec.add_development_dependency "bundler", "~> 1.9"
|
31
32
|
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
-
spec.add_runtime_dependency 'trollop', '~> 2.
|
33
|
+
spec.add_runtime_dependency 'trollop', '~> 2.0'
|
33
34
|
spec.add_runtime_dependency 'mysql2','~> 0.3'
|
34
35
|
spec.add_runtime_dependency 'ipaddress','~> 0.8'
|
35
36
|
end
|
data/lib/gestio2masq.rb
ADDED
data/lib/gestio2masq/CHANGELOG
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 David A. Parker
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gestio2masq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- svdasein
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mysql2
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,8 +98,11 @@ files:
|
|
98
98
|
- Rakefile
|
99
99
|
- exe/gestio2masq
|
100
100
|
- gestio2masq.gemspec
|
101
|
+
- lib/gestio2masq.rb
|
101
102
|
- lib/gestio2masq/CHANGELOG
|
103
|
+
- lib/gestio2masq/LICENSE.txt
|
102
104
|
- lib/gestio2masq/examples/gestio2masq.conf
|
105
|
+
- lib/gestio2masq/version.rb
|
103
106
|
homepage: http://github.com/svdasein/gestio2masq
|
104
107
|
licenses:
|
105
108
|
- MIT
|