Sha256: 397074795277bb5be6b877c319de64d29be1d6dad35eac4e898691faf6867200

Contents?: true

Size: 1.71 KB

Versions: 10

Compression:

Stored size: 1.71 KB

Contents

require 'r10k/deployment'
require 'r10k/action/visitor'
require 'r10k/action/base'
require 'r10k/action/deploy/deploy_helpers'

module R10K
  module Action
    module Deploy
      class Module < R10K::Action::Base

        include R10K::Action::Deploy::DeployHelpers

        def call
          @visit_ok = true

          expect_config!
          deployment = R10K::Deployment.new(@settings)
          check_write_lock!(@settings)

          deployment.accept(self)
          @visit_ok
        end

        include R10K::Action::Visitor

        private

        def visit_deployment(deployment)
          yield
        end

        def visit_source(source)
          yield
        end

        def visit_environment(environment)
          if @opts[:environment] && (@opts[:environment] != environment.dirname)
            logger.debug1(_("Only updating modules in environment %{opt_env} skipping environment %{env_path}") % {opt_env: @opts[:environment], env_path: environment.path})
          else
            logger.debug1(_("Updating modules %{modules} in environment %{env_path}") % {modules: @argv.inspect, env_path: environment.path})
            yield
          end
        end

        def visit_puppetfile(puppetfile)
          puppetfile.load
          yield
        end

        def visit_module(mod)
          if @argv.include?(mod.name)
            logger.info _("Deploying module %{mod_path}") % {mod_path: mod.path}
            mod.sync
          else
            logger.debug1(_("Only updating modules %{modules}, skipping module %{mod_name}") % {modules: @argv.inspect, mod_name: mod.name})
          end
        end

        def allowed_initialize_opts
          super.merge(environment: true)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
r10k-2.5.5 lib/r10k/action/deploy/module.rb
r10k-2.5.4 lib/r10k/action/deploy/module.rb
r10k-2.5.3 lib/r10k/action/deploy/module.rb
r10k-2.5.2 lib/r10k/action/deploy/module.rb
r10k-2.5.1 lib/r10k/action/deploy/module.rb
r10k-2.4.5 lib/r10k/action/deploy/module.rb
r10k-2.4.4 lib/r10k/action/deploy/module.rb
r10k-2.5.0 lib/r10k/action/deploy/module.rb
r10k-2.4.3 lib/r10k/action/deploy/module.rb
r10k-2.4.1 lib/r10k/action/deploy/module.rb