Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7358E7CFC for ; Wed, 7 Dec 2011 15:26:24 +0000 (UTC) Received: (qmail 67949 invoked by uid 500); 7 Dec 2011 15:26:24 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 67933 invoked by uid 500); 7 Dec 2011 15:26:24 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 67925 invoked by uid 99); 7 Dec 2011 15:26:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2011 15:26:24 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Dec 2011 15:26:17 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pB7FPt5i014578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 7 Dec 2011 10:25:55 -0500 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id pB7FPmqn025242 for ; Wed, 7 Dec 2011 10:25:55 -0500 From: mfojtik@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH core 6/8] CIMI: Added possibility to attach MachineAdmin to Machine Date: Wed, 7 Dec 2011 16:26:50 +0100 Message-Id: <1323271612-15649-6-git-send-email-mfojtik@redhat.com> In-Reply-To: <1323271612-15649-1-git-send-email-mfojtik@redhat.com> References: <1323271612-15649-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Virus-Checked: Checked by ClamAV on apache.org From: Michal Fojtik Signed-off-by: Michal fojtik --- clients/cimi/lib/entities/machine.rb | 9 +++++++-- clients/cimi/views/machines/new.haml | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb index 9ef9f3c..d70d0e9 100644 --- a/clients/cimi/lib/entities/machine.rb +++ b/clients/cimi/lib/entities/machine.rb @@ -20,11 +20,14 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity @machine_images = CIMI::Model::MachineImageCollection.from_xml(machine_image_xml) machine_conf_xml = get_entity_collection('machine_configurations', credentials) @machine_configurations = CIMI::Model::MachineConfigurationCollection.from_xml(machine_conf_xml) + machine_admins_xml = get_entity_collection('machine_admins', credentials) + @machine_admins = CIMI::Model::MachineAdminCollection.from_xml(machine_admins_xml) haml :'machines/new' end get '/cimi/machines/:id' do machine_xml = get_entity('machines', params[:id], credentials) + puts machine_xml @machine= CIMI::Model::Machine.from_xml(machine_xml) haml :'machines/show' end @@ -84,11 +87,13 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity xml.name params[:machine][:name] xml.description params[:machine][:description] xml.MachineTemplate { - xml.MachineConfig( :href => params[:machine_configuration] ) - xml.MachineImage( :href => params[:machine_image] ) + xml.MachineConfig( :href => params[:machine][:machine_configuration] ) + xml.MachineImage( :href => params[:machine][:machine_image] ) + xml.MachineAdmin( :href => params[:machine][:machine_admin] ) unless params[:machine][:machine_admin].empty? } } end.to_xml + puts machine_xml begin result = create_entity('machines', machine_xml, credentials) machine = CIMI::Model::MachineCollection.from_xml(result) diff --git a/clients/cimi/views/machines/new.haml b/clients/cimi/views/machines/new.haml index 3434142..984ef9b 100644 --- a/clients/cimi/views/machines/new.haml +++ b/clients/cimi/views/machines/new.haml @@ -38,6 +38,14 @@ %select{ :name => 'machine[machine_configuration]' } - @machine_configurations.machine_configurations.each do |configuration| %option{ :value => configuration.href }=href_to_id(configuration.href) + %div.clearfix + %label{ :for => 'machine[machine_admin]' } + Machine Admin + %div.input + %select{ :name => 'machine[machine_admin]' } + %option{ :value => '', :selected => :selected } + - @machine_admins.machine_admins.each do |admin| + %option{ :value => admin.href }=href_to_id(admin.href) %div.actions %input{ :type => :submit, :class => 'btn primary', :value => "Create machine" } %button{ :type => :reset, :class => 'btn' } Reset -- 1.7.4.4