Script that creates release implemented.

It takes JSON file with following data:
* name of release
* version
* description
* list of roles, each role has name and list of recipes
Each recipe is formatted in the way: cookbook_name@cookbook_version::recipe_name
This commit is contained in:
Mike Scherbakov 2012-06-03 20:49:14 +04:00
parent c9b2cca521
commit 2fe47f2c61
2 changed files with 47 additions and 0 deletions

29
bin/create_release Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# Copyright 2012, Mirantis
require 'rubygems'
require 'json'
require 'httpclient'
if ARGV[0].nil?
puts "Provide path to release file for uploading"
exit 1
end
data = JSON.parse(File.read(File.expand_path(ARGV[0])))
url = "http://127.0.0.1:8000/api/releases"
headers = {"Content-Type" => "application/json"}
cli = HTTPClient.new
begin
res = cli.post(url, data.to_json, headers)
if res.status < 200 or res.status >= 300
puts "Error in creating release: #{res.inspect}"
end
rescue Exception => e
puts "Unknown error: #{e.message}"
end

View File

@ -0,0 +1,18 @@
{
"name": "OpenStack",
"version": "1.0.0",
"description": "The openstack default release",
"roles": [{
"name": "compute",
"recipes": [
"nova@0.1.1::compute",
"nova@0.1.1::monitor"
]
},{
"name": "controller",
"recipes": [
"other_cookbook@2.4.2::api"
]
}
]
}