Sha256: 2554ab7b0db4f17acf67927eecc33d108f224af19ed2d335d7e20ef33811d5b4
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
module HeadChef class Sync def self.sync(environment, force) # Check if environment exits, if not create it # Perform first, if it fails no need to continue unless HeadChef.chef_server.environment.find(environment) HeadChef.chef_server.environment.create(name: environment) end # Diff now performs all Berkshelf/lockfile dependency operations HeadChef.ui.say("Determing side effects of sync with chef environment "\ "#{environment}...", :cyan) cookbook_diff = HeadChef.ui.mute { Diff.diff(environment) } unless force if cookbook_diff.conflicts? HeadChef.ui.error 'The following cookbooks are in conflict:' cookbook_diff.conflicts.each do |cookbook| HeadChef.ui.error "#{cookbook.name}: #{cookbook.berkshelf_version}" end HeadChef.ui.error 'Use --force to sync environment' Kernel.exit(1337) end end # Retrieve berksfile berksfile = HeadChef.berksfile HeadChef.ui.say('Uploading cookbooks to chef server...', :cyan) berksfile.upload({force: force}) # Apply without lock options argument HeadChef.ui.say("Applying Berksfile.lock cookbook version to " \ "environment #{environment}...", :cyan) berksfile.apply(environment, {}) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
head_chef-0.1.1 | lib/head_chef/tasks/sync.rb |
head_chef-0.1.0 | lib/head_chef/tasks/sync.rb |