Sha256: 6b6e5b62bd9cc931094fb90aa90525087a21fdbf8cd271cb4cf8aa926a4d745d

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

require 'json'
require 'commands/add-env'
require 'plan-step-class'
require 'yaml'
require 'canzea/config'

class PreparePlan
    def initialize ()
        @basePath = "#{Pathname.new(Canzea::config[:catalog_location]).realpath}/catalog"
    end

    # Read the blueprint instructions and prepare plan for a particular segment
    def do (blueprint, segment, step, test, privateKey)
        planStep = PlanStep.new

        puts "Processing configure.json for #{segment} in #{blueprint} from #{@basePath}"

        instructions = YAML.load_file("#{@basePath}/blueprints/#{blueprint}/instruction.yml")
        segment = instructions['instructions']['segments'][segment]

        puts segment['abbreviation']

        index = 1
        segment['image'].each { |item|
            if item.start_with?("step:")
                parts = item.split(':')

                if (index < Integer(step))
                    puts "[#{index}] #{item} SKIPPING"
                else
                    puts "[#{index}] #{item}"
                    if (test == false)
                        publicIp = File.read("#{Canzea::config[:pwd]}/vps-DevOps-1.json")
                        RemoteRun.new.do publicIp, privateKey, parts[1], parts[2]
                        # Keep track of what we have done; parsing the response and looking at the JSON
                    end
                end
                index = index + 1
            end
        }
    end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
canzea-0.1.64 lib/commands/prepare-plan.rb
canzea-0.1.63 lib/commands/prepare-plan.rb
canzea-0.1.62 lib/commands/prepare-plan.rb
canzea-0.1.61 lib/commands/prepare-plan.rb
canzea-0.1.60 lib/commands/prepare-plan.rb
canzea-0.1.59 lib/commands/prepare-plan.rb
canzea-0.1.58 lib/commands/prepare-plan.rb
canzea-0.1.57 lib/commands/prepare-plan.rb