Class: Channels

Inherits:
Operation show all
Defined in:
lib/satops/operator.rb

Class Attribute Summary collapse

Attributes inherited from Operation

#log

Instance Method Summary collapse

Methods inherited from Operation

#clone, #create, #destroy, #export, #extra, #import, #initialize, #postsync, #sync

Constructor Details

This class inherits a constructor from Operation

Class Attribute Details

.deleteObject

Returns the value of attribute delete.



118
119
120
# File 'lib/satops/operator.rb', line 118

def delete
  @delete
end

.issObject

Returns the value of attribute iss.



118
119
120
# File 'lib/satops/operator.rb', line 118

def iss
  @iss
end

Instance Method Details

#presync(src_sat, dst_sat) ⇒ Object



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/satops/operator.rb', line 123

def presync(src_sat, dst_sat)
  if Channels.iss
    all_channels=Helpers.filter(src_sat.channel.listAllChannels, 'label').sort
    @result=nil
    3.times do
      iss_cmd="/usr/bin/ssh -q root@#{dst_sat.host.name} '/usr/bin/satellite-sync "
      all_channels.each do |e|
        iss_cmd << "-c #{e} "
      end
      iss_cmd << "; echo $?'"
      @log.info iss_cmd
      @result=%x(#{iss_cmd})
      @log.info @result
      break if @result.chomp.reverse[0,1] == '0'
    end
    raise "Fatal: ISS Failed" if @result.chomp.reverse[0,1] != '0'
  end
rescue RuntimeError => e
  @log.fatal "#{e}"
end