voxpupuli/puppet_webhook

View on GitHub
app/workers/deploy/module.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

require 'r10k/action/deploy/module'

module Deploy
  # This worker deploy a puppet module via the R10K API.
  class ModuleWorker < ApplicationWorker
    def perform(ppt_module, config)
      # r10k doesn't like stringified hash keys. This forces symbolized keys
      config = config.symbolize_keys
      deploy = R10K::Action::Deploy::Module.new({ config: config }, [ppt_module], config)

      R10K::Logging.instance_variable_set(:@outputter, PuppetWebhook::R10KLogProxy.new(logger, logger.level))

      raise 'Failed to deploy' unless deploy.call
    end
  end
end