Class: RHN::Configchannel

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Operation

#action, #action_list, #define, #trace_info, #trace_warn

Constructor Details

#initialize(sat) ⇒ Configchannel

Returns a new instance of Configchannel.



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/satops/rhsat.rb', line 227

def initialize(sat)
  super(sat)
  define 'configchannel.channelExists'
  define 'configchannel.create'
  define 'configchannel.deleteChannels'
  define 'configchannel.deleteFiles'
  define 'configchannel.deleteFileRevisions'
  define 'configchannel.getDetails'
  define 'configchannel.getFileRevision'
  define 'configchannel.getFileRevisions'
  define 'configchannel.listFiles', :list
  define 'configchannel.listGlobals', :list
  define 'configchannel.listSubscribedSystems', :list
  define 'configchannel.lookupFileInfo'
  define 'configchannel.update'
end

Class Method Details

.copyPath(cf) ⇒ Object

Class Methods Remove fields not needed for creation from config file



246
247
248
249
250
# File 'lib/satops/rhsat.rb', line 246

def self.copyPath(cf)
  perms=cf["permissions_mode"]
  cf.delete_if { |k,v| k=="modified" || k=="creation" || k=="binary" || k=="channel" || k=="md5" || k=="path" || k=="type" || k == "permissions_mode" || k == "permissions" }
  cf.merge({ "permissions"=> perms.to_s })
end

Instance Method Details

#createOrUpdatePath(label, file, type) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/satops/rhsat.rb', line 252

def createOrUpdatePath(label, file, type)
  # Type is boolean : false is file, true is Directory
  path=file['path']
  if type
    file_type='directory'
  else
    file_type='file'
  end
  name="configchannel:createOrUpdatePath"
  result=@sat.run('configchannel.createOrUpdatePath', label, file['path'], type, Configchannel.copyPath(file))
  if result
    trace_info(name, label, path)
  else
    case @sat.exception.faultCode
    when 1023
      trace_warn(name, 'Existing', label, path)
    else
      trace_warn(name, 'KO', label, path, @sat.get_exception)
    end
  end
end


274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/satops/rhsat.rb', line 274

def createOrUpdateSymlink(label, cfg_file)
  name="configchannel.createOrUpdateSymlink"
  path=cfg_file['path']
  if @sat.run('configchannel.createOrUpdateSymlink', label, cfg_file['path'], {'target_path' => cfg_file['target_path'], 'revision' => cfg_file['revision']})
    trace_info(name, label, path)
  else
    case @sat.exception.faultCode
    when 1023
      trace_warn(name, 'Existing', label, path)
    else
      trace_warn(name, 'KO', label, path, @sat.get_exception)
    end
  end
end

#exist?(cfg_channel) ⇒ Boolean

Returns:

  • (Boolean)


289
290
291
292
293
294
295
# File 'lib/satops/rhsat.rb', line 289

def exist?(cfg_channel)
  if @sat.run('configchannel.channelExists', cfg_channel['label']) == 1
    return true
  else
    return false
  end
end