Module: R10K::CLI::Deploy::Environment

Defined in:
lib/r10k/cli/deploy.rb

Class Method Summary collapse

Class Method Details

.commandObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/r10k/cli/deploy.rb', line 33

def self.command
  @cmd ||= Cri::Command.define do
    name    'environment'
    usage   'environment <options> <environment> <...>'
    summary 'deploy environments and their dependent modules'

    description <<-DESCRIPTION
`r10k deploy environment` creates and updates Puppet environments based on Git
branches.

Environments can provide a Puppetfile at the root of the directory to deploy
independent Puppet modules. To recursively deploy an environment, pass the
`--puppetfile` flag to the command.

**NOTE**: If an environment has a Puppetfile when it is instantiated a
recursive update will be forced. It is assumed that environments are dependent
on modules specified in the Puppetfile and an update will be automatically
scheduled. On subsequent deployments, Puppetfile deployment will default to off.
    DESCRIPTION

    flag :p, :puppetfile, 'Deploy modules from a puppetfile'

    run do |opts, args, cmd|
      deploy = R10K::Deployment.load_config(opts[:config])

      task = R10K::Task::Deployment::DeployEnvironments.new(deploy)
      task.update_puppetfile = opts[:puppetfile]
      task.environment_names = args

      purge = R10K::Task::Deployment::PurgeEnvironments.new(deploy)

      runner = R10K::TaskRunner.new(:trace => opts[:trace])
      runner.append_task task
      runner.append_task purge
      runner.run

      exit runner.exit_value
    end
  end
end