Sha256: ae1c3cd4e0ac73de14ca5209320a579d6abe1d8d038f8cf10bd3214b7ead8fc0

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

require 'ey-core/cli/errors'

module Ey
  module Core
    module Cli
      module Helpers
        module Chef
          def run_chef(type, environment)
            request = environment.apply(type)
            puts "Started #{type} chef run".green
            request.wait_for { |r| r.ready? }
            if request.successful
              puts "#{type.capitalize} chef run completed".green
            else
              puts "#{type.capitalize} chef run failed".red
              ap request
            end
          end

          def upload_recipes(environment, path="cookbooks/")
            recipes_path = Pathname.new(path)

            if recipes_path.exist? && recipes_path.to_s.match(/\.(tgz|tar\.gz)/)
              environment.upload_recipes(recipes_path)
            elsif recipes_path.exist?
              environment.upload_recipes(archive_directory(path))
            else
              raise RecipesNotFound, "Recipes file not found: #{recipes_path}"
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ey-core-3.1.8 lib/ey-core/cli/helpers/chef.rb
ey-core-3.1.7 lib/ey-core/cli/helpers/chef.rb
ey-core-3.1.6 lib/ey-core/cli/helpers/chef.rb
ey-core-3.1.5 lib/ey-core/cli/helpers/chef.rb
ey-core-3.1.4 lib/ey-core/cli/helpers/chef.rb
ey-core-3.1.3 lib/ey-core/cli/helpers/chef.rb