sfpagent 0.4.11 → 0.4.12
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sfpagent might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/sfpagent/agent.rb +29 -0
- 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: 04d8a36eadf932a9f6042561b7419e312bf73e2f
|
4
|
+
data.tar.gz: 7485c508076ea1c3374ca67c6bec882e971d5853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca3358ea6a730febb5aaddc77fc52f8f212ad9266537ae892ff7e07d3ec05528fdfe6fa27c5af156652c8504306410440372714d2208e1cde1140729aa374b0d
|
7
|
+
data.tar.gz: dac95e949e5134baa9ddd456df190f2068b5b2b7a2534cf54ce5c478f32e4accc15ee056cb0eaa5419066118a3640e10fd598ebbce2c0d4e0cc071ebf0ad17e7
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.12
|
data/lib/sfpagent/agent.rb
CHANGED
@@ -634,6 +634,35 @@ module Sfp
|
|
634
634
|
end
|
635
635
|
}
|
636
636
|
}
|
637
|
+
|
638
|
+
# update /etc/hosts so other applications can resolve the names correctly
|
639
|
+
begin
|
640
|
+
File.open('/etc/hosts', File::RDWR, 0644) do |f|
|
641
|
+
f.flock(File::LOCK_EX)
|
642
|
+
output = ''
|
643
|
+
### remove previous records
|
644
|
+
f.read.each_line do |line|
|
645
|
+
if line =~ /# Edited by Nuri/
|
646
|
+
break
|
647
|
+
else
|
648
|
+
output << line
|
649
|
+
end
|
650
|
+
end
|
651
|
+
### add current records
|
652
|
+
output << "# Edited by Nuri (don't change or add anything below this line)\n"
|
653
|
+
agents.each do |name,agent|
|
654
|
+
next if not (agent['sfpAddress'] =~ /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/)
|
655
|
+
output << "#{agent['sfpAddress']}\t#{name}\n"
|
656
|
+
end
|
657
|
+
### save records
|
658
|
+
f.rewind
|
659
|
+
f.write(output)
|
660
|
+
f.flush
|
661
|
+
f.truncate(f.pos)
|
662
|
+
end
|
663
|
+
rescue Exception => e
|
664
|
+
Sfp::Agent.logger.error e.to_s
|
665
|
+
end
|
637
666
|
end
|
638
667
|
|
639
668
|
true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sfpagent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Herry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sfp
|