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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8747b0974cbb0b64ec21384e0e9f76edce077a6
4
- data.tar.gz: df3d730eaa4ba91b3fc70ea80a9a74efd0f509e8
3
+ metadata.gz: b61d21a9dbd121278e72c2c97471eac0d5ccb1ff
4
+ data.tar.gz: d91d9ac9856658122583990d638bdf67ce9369e4
5
5
  SHA512:
6
- metadata.gz: 26144f170e5a161982eec15e0f7b8b901c4b5a3eb2c73a36991aae6eab7a16476a9d0304d6ebf8b72ddd8fab214729563046f259f05b7a00c355a128f00dc1dd
7
- data.tar.gz: 11f3c42c8f174332aaed9391228c8d97efe19734c67b2023c2a4164e32734a311c42a9b8cac9a5d80c10f0362c435ed7e582f1686624cf1223b42720339065d9
6
+ metadata.gz: 1ab6c7a098c66a0b5d0bb9e8affad2008608e93fd6586a91ef95c36e6ef09ce378578a7447cf546cd7da0de31a1c22b2b99415f3c42b5f37349915f6a115a3cf
7
+ data.tar.gz: 2d0bb9f3230bf8c917e9794a90c9a268b8152ef90a6264dccf53e2b07a739257b31523e0bbf35e359fb868e6eb22c391ffd09a64fd83028f37418506ca8eb6c0
data/History.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ === 2.1.2 (2014-4-21)
2
+ * Fix Network.dns_search (alias dns_domain) to resolve.conf support
3
+
1
4
  === 2.1.1 (2014-4-15)
2
5
  * Use 'syncwrap-' as tmpdir prefix.
3
6
  * Fix Users, RunUser use of useradd, adding -s and -m options, for
data/lib/syncwrap/base.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  #++
16
16
 
17
17
  module SyncWrap
18
- VERSION='2.1.1'
18
+ VERSION='2.1.2'
19
19
 
20
20
  GEM_ROOT = File.dirname(File.dirname(File.dirname(__FILE__))) # :nodoc:
21
21
  end
@@ -27,12 +27,16 @@ module SyncWrap
27
27
  # Host component dependencies: <Distro>
28
28
  class Network < Component
29
29
 
30
- # A default DNS domain name to use for name search, for addition
31
- # to /etc/resolver.conf, etc. (default: nil)
32
- attr_accessor :dns_domain
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
- @dns_domain = nil
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 dns_domain
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
- # FIXME:
83
- warn "Network: not sure if resolver.conf change is permanent?"
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-domain #{dns_domain}' #{f}; then
95
+ if ! grep -E -q '^\\s*dns-search #{dns_search}' #{f}; then
88
96
  cp -f #{f} #{f}~
89
- sed -r -i '/^\\s*dns-domain/d' #{f}
90
- echo ' dns-domain #{dns_domain}' >> #{f}
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.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-15 00:00:00.000000000 Z
11
+ date: 2014-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor