Skip to content

Commit

Permalink
Have feature/grizzly stash the enitre crowbar.yml in to Chef.
Browse files Browse the repository at this point in the history
This will remove some magic from the Git barclamp's build routine.
  • Loading branch information
VictorLowther committed Apr 2, 2013
1 parent ef8878a commit b2b3246
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions releases/feature/grizzly/master/extra/barclamp_mgmt_lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,18 @@ def catalog(path, options={})
# create the groups for the catalog - for now, just groups. other catalogs may be added later
cat = { 'barclamps'=>{} }
barclamps = File.join CROWBAR_PATH, 'barclamps'
system("knife data bag create -k /etc/chef/webui.pem -u chef-webui barclamps")
list = Dir.entries(barclamps).find_all { |e| e.end_with? '.yml'}
# scan the installed barclamps
list.each do |bc_file|
puts "Loading #{bc_file}" if debug
bc = YAML.load_file File.join(barclamps, bc_file)
File.open("#{barclamps}/#{bc_file}.json","w+") { |f|
f.truncate(0)
bc["id"] = bc_file.split('.')[0]
f.puts(JSON.pretty_generate(bc))
}
system("knife data bag from file -k /etc/chef/webui.pem -u chef-webui barclamps \"#{barclamps}/#{bc_file}.json\"")
name = bc['barclamp']['name']
cat['barclamps'][name] = {} if cat['barclamps'][name].nil?
description = bc['barclamp']['description']
Expand Down

0 comments on commit b2b3246

Please sign in to comment.