Class: Automan::Chef::Uploader

Inherits:
Base
  • Object
show all
Defined in:
lib/automan/chef/uploader.rb

Constant Summary

Constants included from Mixins::AwsCaller

Mixins::AwsCaller::S3_PROTO

Instance Attribute Summary

Attributes inherited from Base

#logger, #wait

Attributes included from Mixins::AwsCaller

#as, #cfn, #eb, #ec, #ec2, #elb, #r53, #rds, #s3

Instance Method Summary collapse

Methods inherited from Base

add_option, #initialize, #log_options, #wait_until

Methods included from Mixins::AwsCaller

#account, #configure_aws, #looks_like_s3_path?, #parse_s3_path, #s3_object_exists?, #s3_read

Constructor Details

This class inherits a constructor from Automan::Base

Instance Method Details

#uploadObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/automan/chef/uploader.rb', line 10

def upload
  log_options

  logger.info "packaging #{repopath} to #{tempdir}"
  tgz = Zlib::GzipWriter.new(File.open("#{tempdir}/chef-repo.tgz", 'wb'))
  Minitar.pack(repopath, tgz)

  versions = ["#{chefver}", "latest"]
  versions.each do |version|
    options = {
      localfile: "#{tempdir}/chef-repo.tgz",
      s3file: "#{s3path}/#{version}/chef-repo.tgz"
    }
    s = Automan::S3::Uploader.new options
    s.upload
  end

end