appenv: added description to nodes

This commit is contained in:
Javi Fontan committed 2012-09-13 14:46:43 +02:00
1 parent 78b39cdfc9
commit 42331dec55
3 files changed
+26 -3

No files matched your search

+12 -2
View File
@@ -45,6 +45,14 @@ NAME={
:description => "Name of the node"
}
DESCRIPTION={
:name => "description",
:short => "-d description",
:large => "--description description",
:format => String,
:description => "description of the node"
}
TEMPLATES={
:name => "templates",
:short => "-t t1,t2",
@@ -109,13 +117,14 @@ cmd = CommandParser::CmdParser.new(ARGV) do
EOT
command :create, addnode_desc, [:node_file],
:options => [NAME, TEMPLATES, COOKBOOKS] do
:options => [NAME, TEMPLATES, COOKBOOKS, DESCRIPTION] do
node=OpenNebula::ChefConf.new
node.node=File.read args.first
node.name=options[:name] if options[:name]
node.templates=options[:templates] if options[:templates]
node.cookbooks=options[:cookbooks] if options[:cookbooks]
node.description=options[:description] if options[:description]
client=Client.new
res=node.save(client)
@@ -162,7 +171,7 @@ cmd = CommandParser::CmdParser.new(ARGV) do
EOT
command :update, update_desc, [:node],
:options=>[NAME, TEMPLATES, NODE, COOKBOOKS] do
:options=>[DESCRIPTION, TEMPLATES, NODE, COOKBOOKS] do
client=OpenNebula::Client.new
doc=OpenNebula::ChefDoc.new(
OpenNebula::ChefDoc.build_xml(args[0]),
@@ -181,6 +190,7 @@ cmd = CommandParser::CmdParser.new(ARGV) do
node.templates=options[:templates] if options[:templates]
node.cookbooks=options[:cookbooks] if options[:cookbooks]
node.description=options[:description] if options[:description]
doc.update(node.to_json)
+10 -1
View File
@@ -59,6 +59,10 @@ private
puts str % ["COOKBOOKS", node.node['cookbooks']]
end
if node.node['description']
puts str % ["DESCRIPTION", node.node['description']]
end
puts
CLIHelper.print_header(str_h1 % "PERMISSIONS",false)
@@ -103,7 +107,12 @@ private
d['NAME']
end
default :ID, :NAME
column :DESCRIPTION, "Description of the node",
:size=>50 do |d|
JSON.parse(d['TEMPLATE']['BODY'])['description']
end
default :ID, :NAME, :DESCRIPTION
end
table
+4
View File
@@ -70,6 +70,10 @@ module OpenNebula
@chef['cookbooks']=cookbooks
end
def description=(description)
@chef['description']=description
end
def save(client)
doc=ChefDoc.new(ChefDoc.build_xml, client)