Class: Lita::Handlers::Pulp
Constant Summary
PulpHelper::Repo::REPO_TYPE_PUPPET, PulpHelper::Repo::REPO_TYPE_RPM
Instance Method Summary
collapse
#search_puppet, #search_rpm
#copy_puppet_between_repo!, #copy_rpm_between_repo!, #delete_puppet_newer!, #delete_rpm_newer!, #get_repo, #list_repo, #publish_repo!
#client
Instance Method Details
#copy_puppet(response) ⇒ Object
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
# File 'lib/lita/handlers/pulp.rb', line 325
def copy_puppet(response)
args = response.extensions[:kwargs]
from = args[:from]
to = args[:to]
author = args[:author]
name = args[:name]
version = args[:version]
delete_newer=args[:delete_newer]||false
publish=args[:publish]||false
begin
if from.nil? || to.nil? || author.nil? || name.nil? || version.nil?
raise "Exception: missing required parameters"
end
copy_puppet_between_repo!(from, to, author, name, version, delete_newer, publish)
response.reply "Command executed successfully"
rescue StandardError => e
response.reply e.message
end
end
|
#copy_rpm(response) ⇒ Object
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
|
# File 'lib/lita/handlers/pulp.rb', line 304
def copy_rpm(response)
args = response.extensions[:kwargs]
from = args[:from]
to = args[:to]
release = args[:release]
name = args[:name]
version = args[:version]
arch = args[:arch]
delete_newer=args[:delete_newer]||false
publish=args[:publish]||false
begin
if from.nil? || to.nil? || release.nil? ||name.nil? || version.nil? || arch.nil?
raise "Exception: Missing required paramenter"
end
copy_rpm_between_repo!(from, to, name, version, release, arch, delete_newer, publish)
response.reply "Command executed successfully"
rescue StandardError => e
response.reply e.message
end
end
|
#delete_newer_puppet(response) ⇒ Object
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
# File 'lib/lita/handlers/pulp.rb', line 364
def delete_newer_puppet(response)
args = response.extensions[:kwargs]
from = args[:from]
author = args[:author]
name = args[:name]
version = args[:version]
publish=args[:publish]||false
begin
if from.nil? || author.nil? || name.nil? || version.nil?
raise "Exception: missing required parameters"
end
delete_puppet_newer!(from, author, name, version, publish)
response.reply "Command executed successfully"
rescue StandardError => e
response.reply e.message
end
end
|
#delete_newer_rpm(response) ⇒ Object
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
# File 'lib/lita/handlers/pulp.rb', line 345
def delete_newer_rpm(response)
args = response.extensions[:kwargs]
from = args[:from]
release = args[:release]
name = args[:name]
version = args[:version]
arch = args[:arch]
publish=args[:publish]||false
begin
if from.nil? || author.nil? || name.nil? || version.nil?
raise "Exception: missing required parameters"
end
delete_rpm_newer!(from, name, version, relase, arch, publish)
response.reply "Command executed successfully"
rescue StandardError => e
response.reply e.message
end
end
|
#publish_repo(response) ⇒ Object
239
240
241
242
243
244
245
246
247
248
249
250
251
|
# File 'lib/lita/handlers/pulp.rb', line 239
def publish_repo(response)
repo_id = response.matchs[0][0]
if repo_id
begin
publish_repo(repo_id)
response.reply "Command executed successfully"
rescue Exception => e
response.reply e.message
end
else
response.reply "No repoistory id specified"
end
end
|
#puppet_repos(response) ⇒ Object
216
217
218
219
220
221
222
223
224
225
226
227
228
|
# File 'lib/lita/handlers/pulp.rb', line 216
def puppet_repos(response)
begin
result=list_repo(REPO_TYPE_PUPPET)
s = StringIO.new
result.each do |r|
s << "["<< r[:id] << "] : " << r[:name] << ", " << r[:description] << "\n"
end
response.reply s.string
rescue Exception => e
response.reply e.message
end
end
|
#puppet_search(response) ⇒ Object
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
# File 'lib/lita/handlers/pulp.rb', line 279
def puppet_search(response)
full_name = response.matches[0][0]
repo = response.matches[0][1]
name_spec = full_name.split('/')
puts "name_spec:#{name_spec}"
if name_spec.length >1
author = name_spec[0]
name = name_spec[1]
else
name = full_name
author = nil
end
puts "searching for puppet module #{name} with author: #{author} in repo #{repo}, full_name = #{full_name}"
begin
result=search_puppet(author, name, repo)
s = StringIO.new
result.each do |r|
s << "["<< r[:author] << "/" << r[:name]<< "] : " <<r[:version] << ", " << r[:repos] <<"\n"
end
response.reply s.string
rescue StandardError => e
response.reply e.message
end
end
|
#rpm_repos(response) ⇒ Object
202
203
204
205
206
207
208
209
210
211
212
213
214
|
# File 'lib/lita/handlers/pulp.rb', line 202
def rpm_repos(response)
begin
result=list_repo(REPO_TYPE_RPM)
s = StringIO.new
result.each do |r|
s << "["<< r[:id] << "] : " << r[:name] << ", " << r[:description] << "\n"
end
response.reply s.string
rescue Exception => e
response.reply e.message
end
end
|
#rpm_search(response) ⇒ Object
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
# File 'lib/lita/handlers/pulp.rb', line 253
def rpm_search(response)
name = response.matches[0][0]
repo = response.matches[0][1]
puts "searching for rpm #{name} in repo #{repo}"
begin
result=search_rpm(name, repo)
s = StringIO.new
result.each do |r|
s << "["<< r[:name] << "] : " << r[:version] << ", " << r[:release] << ", " << r[:repos] <<"\n"
end
response.reply s.string
rescue StandardError => e
response.reply e.message
end
end
|
#show_repo(response) ⇒ Object
230
231
232
233
234
235
236
237
238
|
# File 'lib/lita/handlers/pulp.rb', line 230
def show_repo(response)
repo_id = response.matches[0][0]
begin
repo = get_repo(repo_id)
response.reply JSON.pretty_generate(repo)
rescue Exception => e
response.reply e.message
end
end
|