syncwrap 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.rdoc +3 -0
- data/lib/syncwrap/base.rb +1 -1
- data/lib/syncwrap/components/network.rb +42 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b61d21a9dbd121278e72c2c97471eac0d5ccb1ff
|
4
|
+
data.tar.gz: d91d9ac9856658122583990d638bdf67ce9369e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ab6c7a098c66a0b5d0bb9e8affad2008608e93fd6586a91ef95c36e6ef09ce378578a7447cf546cd7da0de31a1c22b2b99415f3c42b5f37349915f6a115a3cf
|
7
|
+
data.tar.gz: 2d0bb9f3230bf8c917e9794a90c9a268b8152ef90a6264dccf53e2b07a739257b31523e0bbf35e359fb868e6eb22c391ffd09a64fd83028f37418506ca8eb6c0
|
data/History.rdoc
CHANGED
data/lib/syncwrap/base.rb
CHANGED
@@ -27,12 +27,16 @@ module SyncWrap
|
|
27
27
|
# Host component dependencies: <Distro>
|
28
28
|
class Network < Component
|
29
29
|
|
30
|
-
# A
|
31
|
-
# to
|
32
|
-
|
30
|
+
# A dns search list (a single domain or space delimited list of
|
31
|
+
# domains) for addition to the resolv.conf search option,
|
32
|
+
# etc. (default: nil)
|
33
|
+
attr_accessor :dns_search
|
34
|
+
|
35
|
+
alias :dns_domain :dns_search
|
36
|
+
alias :dns_domain= :dns_search=
|
33
37
|
|
34
38
|
def initialize( opts = {} )
|
35
|
-
@
|
39
|
+
@dns_search = nil
|
36
40
|
super
|
37
41
|
end
|
38
42
|
|
@@ -67,33 +71,52 @@ module SyncWrap
|
|
67
71
|
end
|
68
72
|
|
69
73
|
def update_resolver
|
70
|
-
if
|
71
|
-
# (Temporary) inclusion direct to resolver.conf
|
72
|
-
sudo <<-SH
|
73
|
-
if ! grep -q 'search.* #{dns_domain}' /etc/resolver.conf; then
|
74
|
-
cp -f /etc/resolver.conf /etc/resolver.conf~
|
75
|
-
sed -i '/^search/d' /etc/resolver.conf
|
76
|
-
echo 'search #{dns_domain}' >> /etc/resolver.conf
|
77
|
-
fi
|
78
|
-
SH
|
79
|
-
|
74
|
+
if dns_search
|
80
75
|
case distro
|
81
76
|
when RHEL
|
82
|
-
|
83
|
-
|
77
|
+
update_resolv_conf
|
78
|
+
|
79
|
+
f='/etc/sysconfig/network-scripts/ifcfg-eth0'
|
80
|
+
sudo <<-SH
|
81
|
+
if ! grep -q '^SEARCH=.*#{dns_search}' #{f}; then
|
82
|
+
cp -f #{f} #{f}~
|
83
|
+
sed -i '/^SEARCH=/d' #{f}
|
84
|
+
echo 'SEARCH="#{dns_search}"' >> #{f}
|
85
|
+
fi
|
86
|
+
SH
|
87
|
+
|
84
88
|
when Ubuntu
|
89
|
+
# As of 12.04 - Precise; /etc/resolv.conf is a symlink that
|
90
|
+
# should not be lost.
|
91
|
+
update_resolv_conf( '/run/resolvconf/resolv.conf' )
|
92
|
+
|
85
93
|
f='/etc/network/interfaces'
|
86
94
|
sudo <<-SH
|
87
|
-
if ! grep -E -q '^\\s*dns-
|
95
|
+
if ! grep -E -q '^\\s*dns-search #{dns_search}' #{f}; then
|
88
96
|
cp -f #{f} #{f}~
|
89
|
-
sed -r -i '/^\\s*dns-
|
90
|
-
echo ' dns-
|
97
|
+
sed -r -i '/^\\s*dns-search/d' #{f}
|
98
|
+
echo ' dns-search #{dns_search}' >> #{f}
|
91
99
|
fi
|
92
100
|
SH
|
101
|
+
|
93
102
|
end
|
94
103
|
end
|
95
104
|
end
|
96
105
|
|
106
|
+
protected
|
107
|
+
|
108
|
+
# Make a temporary adjustment to search domains directly to the
|
109
|
+
# resolv.conf file.
|
110
|
+
def update_resolv_conf( f = '/etc/resolv.conf' )
|
111
|
+
sudo <<-SH
|
112
|
+
if ! grep -q '^search.* #{dns_search}' #{f}; then
|
113
|
+
cp -f #{f} #{f}~
|
114
|
+
sed -i '/^search/d' #{f}
|
115
|
+
echo 'search #{dns_search}' >> #{f}
|
116
|
+
fi
|
117
|
+
SH
|
118
|
+
end
|
119
|
+
|
97
120
|
end
|
98
121
|
|
99
122
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syncwrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Kellum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: term-ansicolor
|