lib/sfpagent/agent.rb in sfpagent-0.2.5 vs lib/sfpagent/agent.rb in sfpagent-0.2.6
- old
+ new
@@ -260,10 +260,14 @@
begin
File.open(BSigFile, File::RDWR|File::CREAT, 0600) { |f|
f.flock(File::LOCK_EX)
Sfp::Agent.logger.info "Setting the BSig model [Wait]"
f.rewind
- data = (bsig.nil? ? '' : JSON.generate(bsig))
+ data = ''
+ if !bsig.nil?
+ bsig['operators'].each_index { |i| bsig['operators'][i]['id'] = i }
+ data = JSON.generate(bsig)
+ end
f.write(data)
f.flush
f.truncate(f.pos)
}
Sfp::Agent.logger.info "Setting the BSig model [OK]"