[PATCH conductor]
by Maros Zatko
Corrected subcollection in #index of target images controller
Added tests
12 years, 6 months
[PATCH aeolus-conductor] Updated Views include providerimages
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/views/api/images/_factory_image.xml.haml | 5 ++++-
src/app/views/api/target_images/_image.xml.haml | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/app/views/api/images/_factory_image.xml.haml b/src/app/views/api/images/_factory_image.xml.haml
index b930577..bb33fda 100644
--- a/src/app/views/api/images/_factory_image.xml.haml
+++ b/src/app/views/api/images/_factory_image.xml.haml
@@ -4,4 +4,7 @@
%target_images
- image.build.target_images.each do |target_image|
%target_image{:id => target_image.id, :href => api_target_image_url(target_image.id)}
- %status=(Aeolus::Image::Factory::TargetImage.status(target_image.id) || "COMPLETE")
+ %provider_images
+ - target_image.provider_images.each do |provider_image|
+ %provider_image{:id => provider_image.id, :href => api_provider_image_url(provider_image.id)}
+ %status=(Aeolus::Image::Factory::TargetImage.status(target_image.id) || "COMPLETE")
\ No newline at end of file
diff --git a/src/app/views/api/target_images/_image.xml.haml b/src/app/views/api/target_images/_image.xml.haml
index 4d6ad8a..b242f97 100644
--- a/src/app/views/api/target_images/_image.xml.haml
+++ b/src/app/views/api/target_images/_image.xml.haml
@@ -7,6 +7,6 @@
%template= image.template
%build{:href=>api_build_url(image.build.id), :id=>image.build.id}
%status="COMPLETE"
- %provider_image
+ %provider_images
- image.provider_images.each do |pimg|
%provider_image{:id => pimg.id, :href => api_provider_image_url(pimg.id)}
--
1.7.6.4
12 years, 6 months
[PATCH aeolus-image 2/4] Updated BuildCommand to talk to conductor
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
lib/aeolus_cli/command/build_command.rb | 60 ++++++++----------
spec/command/build_command_spec.rb | 26 +++++---
spec/vcr/cassettes/command/build_command/build.yml | 66 ++++++++++++++++++++
3 files changed, 107 insertions(+), 45 deletions(-)
create mode 100644 spec/vcr/cassettes/command/build_command/build.yml
diff --git a/lib/aeolus_cli/command/build_command.rb b/lib/aeolus_cli/command/build_command.rb
index 78b361c..8bd5b93 100644
--- a/lib/aeolus_cli/command/build_command.rb
+++ b/lib/aeolus_cli/command/build_command.rb
@@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'imagefactory'
-
module Aeolus
module CLI
class BuildCommand < BaseCommand
@@ -28,42 +26,42 @@ module Aeolus
:build => ''
}
@options = default.merge(@options)
- @console = ImageFactoryConsole.new()
- @console.start
end
def run
if combo_implemented?
- @options[:template_str] = read_file(@options[:template])
- if @options[:template_str].nil?
- puts "Cannot find specified file"
- quit(1)
- end
+ template = read_template
+ validate_xml_schema(template)
- # Validate XML against TDL Schema
- errors = validate_xml_document(File.dirname(__FILE__) + "/../../../examples/tdl.rng", @options[:template_str])
- if errors.length > 0
- puts "ERROR: The given Template does not conform to the TDL Schema, see below for specific details:"
- errors.each do |error|
- puts "- " + error.message
- end
- quit(1)
- end
+ image = Aeolus::CLI::Image.new({:targets => @options[:target].to_s, :tdl => template})
+ image.save!
+ puts "Image: " + image.id
+ puts "Build: " + image.build.id
+ puts "Target Image: " + image.build.target_images.target_image.id
+ quit(0)
+ end
+ end
- #This is a temporary hack in case the agent doesn't show up on bus immediately
- sleep(5)
- @console.build(@options[:template_str], @options[:target], @options[:image], @options[:build]).each do |adaptor|
- puts ""
- puts "Target Image: #{adaptor.image_id}"
- puts "Image: #{adaptor.image}"
- puts "Build: #{adaptor.build}"
- puts "Status: #{adaptor.status}"
- puts "Percent Complete: #{adaptor.percent_complete}"
+ def validate_xml_schema(xml)
+ errors = validate_xml_document(File.dirname(__FILE__) + "/../../../examples/tdl.rng", xml)
+ if errors.length > 0
+ puts "ERROR: The given Template does not conform to the TDL Schema, see below for specific details:"
+ errors.each do |error|
+ puts "- " + error.message
end
- quit(0)
+ quit(1)
end
end
+ def read_template
+ template = read_file(@options[:template])
+ if template.nil?
+ puts "Cannot find specified file"
+ quit(1)
+ end
+ template
+ end
+
def combo_implemented?
if @options[:template].empty? || @options[:target].empty?
puts "This combination of parameters is not currently supported"
@@ -71,12 +69,6 @@ module Aeolus
end
true
end
-
- def quit(code)
- @console.shutdown
- super
- end
-
end
end
end
diff --git a/spec/command/build_command_spec.rb b/spec/command/build_command_spec.rb
index c9887d0..0ab2fbd 100644
--- a/spec/command/build_command_spec.rb
+++ b/spec/command/build_command_spec.rb
@@ -18,22 +18,25 @@ module Aeolus
module CLI
describe BuildCommand do
before(:each) do
- @options[:target] = ['mock','ec2']
- @options[:template] = "#{File.dirname(__FILE__)}" + "/../examples/custom_repo.tdl"
+ @options[:target] = ['ec2']
+ @options[:template] = "#{File.dirname(__FILE__)}" + "../../fixtures/valid_template.tdl"
end
describe "#run" do
it "should kick off a build with valid options" do
- b = BuildCommand.new(@options, @output)
- begin
- b.run
- rescue SystemExit => e
- e.status.should == 0
+ VCR.use_cassette('command/build_command/build') do
+ b = BuildCommand.new(@options, @output)
+ begin
+ b.run
+ rescue SystemExit => e
+ e.status.should == 0
+ end
+ $stdout.string.should include("Image:")
+ $stdout.string.should include("Target Image:")
+ $stdout.string.should include("Build:")
end
- $stdout.string.should include("Image:")
- $stdout.string.should include("Target Image:")
- $stdout.string.should include("Build:")
end
+
it "should exit with a message if only image id is provided" do
@options.delete(:template)
@options.delete(:target)
@@ -46,8 +49,9 @@ module Aeolus
end
$stdout.string.should include("This combination of parameters is not currently supported")
end
+
it "should exit with appropriate message when a non compliant template is given" do
- @options[:template] = "spec/fixtures/invalid_template.tdl"
+ @options[:template] = "#{File.dirname(__FILE__)}" + "../../fixtures/invalid_template.tdl"
@options[:image] = '825c94d1-1353-48ca-87b9-36f02e069a8d'
b = BuildCommand.new(@options, @output)
begin
diff --git a/spec/vcr/cassettes/command/build_command/build.yml b/spec/vcr/cassettes/command/build_command/build.yml
new file mode 100644
index 0000000..c1e6dc1
--- /dev/null
+++ b/spec/vcr/cassettes/command/build_command/build.yml
@@ -0,0 +1,66 @@
+---
+- !ruby/struct:VCR::HTTPInteraction
+ request: !ruby/struct:VCR::Request
+ method: :post
+ uri: https://admin:password@localhost/conductor/api/images.xml
+ body: |
+ <?xml version="1.0" encoding="UTF-8"?>
+ <image>
+ <targets>ec2</targets>
+ <tdl><template>
+ <name>tmpl1</name>
+ <description>foo</description>
+ <os>
+ <name>Fedora</name>
+ <arch>x86_64</arch>
+ <version>14</version>
+ <install type="url">
+ <url>http://download.fedoraproject.org/pub/fedora/linux/releases/14/Fed...
+ </install>
+ </os>
+ <repositories>
+ <repository name="custom">
+ <url>http://repos.fedorapeople.org/repos/aeolus/demo/webapp/</url>
+ <signed>false</signed>
+ </repository>
+ </repositories>
+ </template></tdl>
+ </image>
+
+ headers:
+ content-type:
+ - application/xml
+ response: !ruby/struct:VCR::Response
+ status: !ruby/struct:VCR::ResponseStatus
+ code: 200
+ message: OK
+ headers:
+ x-ua-compatible:
+ - IE=Edge
+ etag:
+ - "\"30d8cefae8512ba1ca0339ea65a97a11\""
+ content-type:
+ - application/xml; charset=utf-8
+ server:
+ - WEBrick/1.3.1 (Ruby/1.8.7/2011-06-30)
+ date:
+ - Tue, 18 Oct 2011 20:43:34 GMT
+ x-runtime:
+ - "0.610872"
+ content-length:
+ - "506"
+ set-cookie:
+ - _session_id=BAh7CCIPc2Vzc2lvbl9pZCIlNDM1MDhhNTU5OTUyZGExMjI0ZmMxNTQxODk5ZjAyNmIiGXdhcmRlbi51c2VyLnVzZXIua2V5aQYiEGJyZWFkY3J1bWJzWwA%3D--413b56edceb09120972fbb2569938f03184f2ca8; path=/; HttpOnly
+ cache-control:
+ - max-age=0, private, must-revalidate
+ body: |
+ <image href='http://localhost:3000/api/images/a36ad5dd-b050-4dc3-bdc2-848fdcc9d956' id='a36ad5dd-b050-4dc3-bdc2-848fdcc9d956'>
+ <build href='http://localhost:3000/api/builds/48fb708a-902e-4767-b7c4-161e43103b95' id='48fb708a-902e-4767-b7c4-161e43103b95'>
+ <target_images>
+ <target_image href='http://localhost:3000/api/target_images/f99926c1-86f7-4062-879d-b149b5325afe' id='f99926c1-86f7-4062-879d-b149b5325afe'></target_image>
+ <status>New</status>
+ </target_images>
+ </build>
+ </image>
+
+ http_version: "1.1"
\ No newline at end of file
--
1.7.6.4
12 years, 6 months
[PATCH aeolus-image 1/2] Updated tdl to conform to new schema
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
examples/custom_repo.tdl | 1 +
examples/tdl.rng | 1 -
2 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/examples/custom_repo.tdl b/examples/custom_repo.tdl
index 2f96604..8a462f7 100644
--- a/examples/custom_repo.tdl
+++ b/examples/custom_repo.tdl
@@ -2,6 +2,7 @@
<name>tmpl1</name>
<description>foo</description>
<os>
+ <rootpw>password</rootpw>
<name>Fedora</name>
<arch>x86_64</arch>
<version>14</version>
diff --git a/examples/tdl.rng b/examples/tdl.rng
index ac2faf9..65fe19a 100644
--- a/examples/tdl.rng
+++ b/examples/tdl.rng
@@ -1,5 +1,4 @@
<?xml version="1.0"?>
-<!-- This Schema is lifted from the OZ project: http://www.aeolusproject.org/oz.html any changes to this schema should be done in the upstream project, then added here-->
<!-- A Relax NG schema for the TDL (template description language) format -->
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
--
1.7.6.4
12 years, 6 months
[PATCH conductor] Initial patch of i18n-rev.3
by jzigmund@redhat.com
Changes in patchset:
- added method set_locale in app_controller(according to Matt's patch ([PATCH] Application controller detects locale from ACCEPT_LANGUAGE header).
- revise all strings in "Monitor section" to be ready to translate
- added cs.yml file for demonstration i18n in "Monitor section" (notice: Czech words in that file aren't real, I generated them via script w/ random strings)
- patch 2/8 revise all flash messages, in en.yml file w/ this structure:
flash:
error:
foo: Foo
notice:
bar: Bar
warning:
12 years, 6 months
[PATCH] BZ#747251 Fixes error messages and pushes the into I18n
by Chris Alfonso
---
src/app/models/instance.rb | 25 +++++++++++++------------
src/config/locales/en.yml | 14 ++++++++++++++
2 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb
index 4b282e9..a83b2f5 100644
--- a/src/app/models/instance.rb
+++ b/src/app/models/instance.rb
@@ -216,7 +216,7 @@ class Instance < ActiveRecord::Base
def total_state_time(state)
if !STATES.include?(state)
- return "Error, could not calculate state time: invalid state"
+ return I18n.t('instances.errors.invalid_state')
end
case state
@@ -249,7 +249,7 @@ class Instance < ActiveRecord::Base
end
else
- return "Error, could not calculate state time: state is not monitored"
+ return I18n.t('state_not_monitored')
end
end
@@ -326,11 +326,12 @@ class Instance < ActiveRecord::Base
def matches
errors = []
if pool.pool_family.provider_accounts.empty?
- errors << 'There are no provider accounts associated with pool family of selected pool.'
+ errors << I18n.t('instances.errors.no_provider_accounts')
end
- errors << 'Pool quota reached' if pool.quota.reached?
- errors << 'Pool family quota reached' if pool.pool_family.quota.reached?
- errors << 'User quota reached' if owner.quota.reached?
+ errors << I18n.t('instances.errors.pool_quota_reached') if pool.quota.reached?
+ errors << I18n.t('instances.errors.pool_family_quota_reached') if pool.pool_family.quota.reached?
+ errors << I18n.t('instances.errors.user_quota_reached') if owner.quota.reached?
+ errors << I18n.t('instances.errors.image_not_found', :b_uuid=> image_build_uuid, :i_uuid => image_uuid) if image_build.nil? and image.nil?
return [[], errors] unless errors.empty?
build = image_build || image.latest_build
@@ -342,27 +343,27 @@ class Instance < ActiveRecord::Base
hwp = HardwareProfile.match_provider_hardware_profile(account.provider,
hardware_profile)
unless hwp
- errors << "#{account.name}: hardware profile match not found"
+ errors << I18n.t('instances.errors.hw_profile_match_not_found', :account_name => account.name)
next
end
account_images = provider_images.select {|pi| pi.provider == account.provider}
if account_images.empty?
- errors << "#{account.name}: image is not pushed to this provider account"
+ errors << I18n.t('instances.errors.image_not_pushed_to_provider', :account_name => account.name)
next
end
if account.quota.reached?
- errors << "#{account.name}: provider account quota reached"
+ errors << I18n.t('instances.errors.provider_account_quota_reached', :account_name => account.name)
next
end
if requires_config_server? and account.config_server.nil?
- errors << "#{account.name}: no config server available for provider account"
+ errors << I18n.t('instances.errors.no_config_server_available', :account_name => account.name)
next
end
account_images.each do |pi|
if not frontend_realm.nil?
brealms = frontend_realm.realm_backend_targets.select {|brealm_target| brealm_target.target_provider == account.provider}
if brealms.empty?
- errors << "Realm #{frontend_realm.name} is not mapped to any provider or provider realm"
+ errors << I18n.t('instances.errors.realm_not_mapped', :frontend_realm_name => frontend_realm.name)
next
end
brealms.each do |brealm_target|
@@ -428,7 +429,7 @@ class Instance < ActiveRecord::Base
matches.reject! do |match|
rejected = false
if !match.provider_account.quota.can_start? instances
- errors << "#{match.provider_account} quota limit too low to launch deployable"
+ errors << I18n.t('instances.errors.provider_account_quota_too_low', :match_provider_account => match.provider_account)
rejected = true
end
rejected
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index d94d420..57a1df8 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -131,6 +131,20 @@ en:
one: "The instance %{list} could not be deleted."
other: "The instances %{list} could not be deleted."
none_selected: "You must select one or more instances to stop."
+ errors:
+ image_not_found: "No image build was found with uuid %{b_uuid} and no image was found with uuid %{i_uuid}"
+ user_quota_reached: "User quota reached"
+ pool_family_quota_reached: "Pool family quota reached"
+ pool_quota_reached: "Pool quota reached"
+ no_provider_accounts: "There are no provider accounts associated with pool family of selected pool."
+ invalid_state: "Error, could not calculate state time: invalid state"
+ state_not_monitored: "Error, could not calculate state time: state is not monitored"
+ hw_profile_match_not_found: "%{account_name}: hardware profile match not found"
+ image_not_pushed_to_provider: "%{account_name}: image is not pushed to this provider account"
+ provider_account_quota_reached: "%{account_name}: provider account quota reached"
+ no_config_server_available: "%{account_name}: no config server available for provider account"
+ realm_not_mapped: "Realm %{frontend_realm_name} is not mapped to any provider or provider realm"
+ provider_account_quota_too_low: "%{match_provider_account} quota limit too low to launch deployable"
searches: Searches
image_factory: Image Factory
assemblies: Assemblies
--
1.7.6.4
12 years, 6 months
[PATCH] New Deployment launch confirmation page
by Tomas Sedovic
These patches together implement Redmine tasks #2523 and #2524.
Patches #2 and #3 are new, but they depend on #1 which I've sent a few days
earlier.
I'm including it here as they're closely tied together and it needs a review
anyway.
12 years, 6 months
Tag Releases
by Martyn Taylor
Gents
Can we please add remote tags to the each repo branch for the commit
that we build from at the end of each sprint. It's a relatively small
overhead and means we can easily checkout our last known working
commit. This is valuable for developers and so should be easily
accessible. It also gives us a general idea of what progress has been
made on each progress in each sprint, by viewing the commits between
each tag.
I'm hoping we can make this part of the release process.
Thanks
Martyn
12 years, 6 months