Sha256: 1784797f8ceba4b4b9610c1a8e1304e377052bf3e85c785bcc0185347ddffd8b

Contents?: true

Size: 1.32 KB

Versions: 71

Compression:

Stored size: 1.32 KB

Contents

require 'json'
require 'logger'
require 'commands/add-env'
require 'plan-step-class'

class ApplyConfig
    def initialize ()
        @log = Logger.new(Canzea::config[:logging_root] + '/plans.log')
    end

    def do (gitRoot, test = false, stepNum = nil, task = nil)
        ps = PlanStep.new

        # Read the configuration file and make calls out to run

        log "Processing #{gitRoot}/configure.json"

        steps = JSON.parse(File.read("#{gitRoot}/configure.json"))


        index = 1
        steps["steps"].each { | step |

            # Needs to be after each step because new env vars could be set (i.e./ CONSUL_URL)
            AddEnv.new.injectEnvironmentVariables()

            ref = "Step #{index.to_s.rjust(2, "0")} / #{steps['steps'].length}"

            role = step['role']
            solution = step['solution']

            ENV['ES_STEP'] = "#{index}";

            if (stepNum == nil or index >= Integer(stepNum))
                log "  [#{ref}] Configure for #{role} and #{solution}"
                ps.runPhaseConfigure role, solution, test, (task == nil ? 1:task), ref
                task = 1
            else
                log "  [#{ref}] Configure for #{role} and #{solution} SKIP"
            end
            index = index + 1
        }
    end

    def log (msg)
        puts msg
        @log.info(msg)
    end

end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
canzea-0.1.180 lib/commands/apply-config.rb
canzea-0.1.179 lib/commands/apply-config.rb
canzea-0.1.178 lib/commands/apply-config.rb
canzea-0.1.177 lib/commands/apply-config.rb
canzea-0.1.176 lib/commands/apply-config.rb
canzea-0.1.175 lib/commands/apply-config.rb
canzea-0.1.174 lib/commands/apply-config.rb
canzea-0.1.173 lib/commands/apply-config.rb
canzea-0.1.172 lib/commands/apply-config.rb
canzea-0.1.171 lib/commands/apply-config.rb
canzea-0.1.170 lib/commands/apply-config.rb
canzea-0.1.169 lib/commands/apply-config.rb
canzea-0.1.167 lib/commands/apply-config.rb
canzea-0.1.166 lib/commands/apply-config.rb
canzea-0.1.165 lib/commands/apply-config.rb
canzea-0.1.160 lib/commands/apply-config.rb
canzea-0.1.159 lib/commands/apply-config.rb
canzea-0.1.158 lib/commands/apply-config.rb
canzea-0.1.157 lib/commands/apply-config.rb
canzea-0.1.156 lib/commands/apply-config.rb