mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 04:12:37 +09:00
appenv: added description to nodes
This commit is contained in:
1 parent
78b39cdfc9
commit
42331dec55
3 files changed
+26
-3
No files matched your search
Vendored
+12
-2
@@ -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)
|
||||
|
||||
|
||||
Vendored
+10
-1
@@ -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
|
||||
|
||||
Vendored
+4
@@ -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)
|
||||
|
||||
|
||||
Reference in new issue
Block a user