[PATCH conductor] Issue #1701: Push to provider.
by Jason Guiditta
https://www.aeolusproject.org/redmine/issues/1701
Simple first pass, subset of full flag list implemented. For now, we support:
push --provider PROVIDER1,Provider2 --id $image_id
QMF notifications of push status will be added in a later patch.
---
.../aeolus-image/lib/config_parser.rb | 7 +-
.../image_factory/aeolus-image/lib/push_command.rb | 37 +++++++++++
.../aeolus-image/spec/build_command_spec.rb | 2 +-
.../aeolus-image/spec/config_parser_spec.rb | 2 +-
.../aeolus-image/spec/push_command_spec.rb | 64 ++++++++++++++++++++
5 files changed, 107 insertions(+), 5 deletions(-)
create mode 100644 services/image_factory/aeolus-image/spec/push_command_spec.rb
diff --git a/services/image_factory/aeolus-image/lib/config_parser.rb b/services/image_factory/aeolus-image/lib/config_parser.rb
index b59a723..5e6b84f 100644
--- a/services/image_factory/aeolus-image/lib/config_parser.rb
+++ b/services/image_factory/aeolus-image/lib/config_parser.rb
@@ -51,7 +51,7 @@ module Aeolus
opts.on('-d', '--id ID', 'id for a given object') do |id|
@options[:id] = id
end
- opts.on('-r', '--provider NAME', 'name of specific provider (ie ec2-us-east1)') do |name|
+ opts.on('-r', '--provider NAME1,NAME2', Array,'name of specific provider (ie ec2-us-east1)') do |name|
@options[:provider] = name
end
opts.on('-I', '--image ID', 'ID of the base image, can be used in build and push commands, see examples') do |id|
@@ -138,7 +138,7 @@ module Aeolus
opts.separator ""
opts.separator "Push examples:"
- opts.separator "aeolus-image push --provider ec2-us-east-1 --id $target_image_id # push the target image to the specified provider"
+ opts.separator "aeolus-image push --provider ec2-us-east-1,my-rhev-m --id $image_id # push the image to the specified providers"
opts.separator "aeolus-image push --build $build_id # push all target images for a build, to same providers as previously"
opts.separator "aeolus-image push --account $provider_account --build $build_id # ditto, using a specific provider account"
opts.separator "aeolus-image push --image $image_id # push all the target images for the latest build"
@@ -187,7 +187,8 @@ module Aeolus
end
def push
- "Not implemented"
+ b = PushCommand.new(@options)
+ b.run
end
def import
diff --git a/services/image_factory/aeolus-image/lib/push_command.rb b/services/image_factory/aeolus-image/lib/push_command.rb
index f51e851..1beeb54 100644
--- a/services/image_factory/aeolus-image/lib/push_command.rb
+++ b/services/image_factory/aeolus-image/lib/push_command.rb
@@ -1,8 +1,45 @@
+require 'rest_client'
+
module Aeolus
module Image
class PushCommand < BaseCommand
+ attr_accessor :console
def initialize(opts={}, logger=nil)
super(opts, logger)
+ @console = ImageFactoryConsole.new()
+ @console.start
+ end
+ def run
+ if combo_implemented?
+ sleep(5)
+ @console.push(@options[:provider], get_creds, @options[:id]).each do |adaptor|
+ puts ""
+ puts "Provider Image: #{adaptor.image_id}"
+ puts "Image: #{adaptor.image}"
+ puts "Build: #{adaptor.build}"
+ puts "Status: #{adaptor.status}"
+ puts "Percent Complete: #{adaptor.percent_complete}"
+ end
+ quit(0)
+ end
+ end
+
+ def get_creds
+ conductor['provider_accounts'].get
+ end
+
+ def combo_implemented?
+ if @options[:provider].empty? || @options[:id].empty?
+ puts "This combination of parameters is not currently supported"
+ quit(1)
+ end
+ true
+ end
+
+ private
+ def quit(code)
+ @console.shutdown
+ exit(code)
end
end
end
diff --git a/services/image_factory/aeolus-image/spec/build_command_spec.rb b/services/image_factory/aeolus-image/spec/build_command_spec.rb
index 11182bf..3931917 100644
--- a/services/image_factory/aeolus-image/spec/build_command_spec.rb
+++ b/services/image_factory/aeolus-image/spec/build_command_spec.rb
@@ -9,7 +9,7 @@ module Aeolus
@stdout_orig = $stdout
$stdout = StringIO.new
@options = {}
- @options[:target] = ['mock','mock']
+ @options[:target] = ['mock','ec2']
@options[:template] = 'spec/sample_data/custom_repo.tdl'
end
diff --git a/services/image_factory/aeolus-image/spec/config_parser_spec.rb b/services/image_factory/aeolus-image/spec/config_parser_spec.rb
index 7473add..434285f 100644
--- a/services/image_factory/aeolus-image/spec/config_parser_spec.rb
+++ b/services/image_factory/aeolus-image/spec/config_parser_spec.rb
@@ -61,7 +61,7 @@ module Aeolus
it "should set options hash for valid push options" do
config_parser = ConfigParser.new(%w(push --provider ec2-us-east1 --id 12345))
- config_parser.options[:provider].should == 'ec2-us-east1'
+ config_parser.options[:provider].should == ['ec2-us-east1']
config_parser.options[:id].should == '12345'
end
diff --git a/services/image_factory/aeolus-image/spec/push_command_spec.rb b/services/image_factory/aeolus-image/spec/push_command_spec.rb
new file mode 100644
index 0000000..e454728
--- /dev/null
+++ b/services/image_factory/aeolus-image/spec/push_command_spec.rb
@@ -0,0 +1,64 @@
+require 'spec_helper'
+require 'stringio'
+
+module Aeolus
+ module Image
+ describe PushCommand do
+
+ before(:each) do
+ @output = double('output')
+ @stdout_orig = $stdout
+ $stdout = StringIO.new
+ @options = {}
+ @options[:provider] = ['mock']
+ @options[:user] = 'admin'
+ @options[:password] = 'password'
+ end
+
+ after(:each) do
+ $stdout = @stdout_orig
+ end
+
+ describe "#run" do
+ before(:each) do
+ options = {}
+ options[:target] = ['mock','ec2']
+ options[:template] = 'spec/sample_data/custom_repo.tdl'
+ b = BuildCommand.new(options)
+ sleep(5)
+ b.console.build(b.read_file, ['mock','ec2']).each do |adaptor|
+ @build_id = adaptor.image
+ end
+ b.console.shutdown
+ @options[:id] = @build_id
+ end
+
+ it "should push an image with valid options" do
+ p = PushCommand.new(@options, @output)
+ begin
+ p.run
+ rescue SystemExit => e
+ e.status.should == 0
+ end
+ $stdout.string.should include("Image:")
+ $stdout.string.should include("Provider Image:")
+ $stdout.string.should include("Build:")
+ end
+ end
+
+ describe "#combo_implemented?" do
+ it "should give useful feedback if no template or target is specified" do
+ @options[:id] = ''
+ @options[:provider] = []
+ b = PushCommand.new(@options, @output)
+ begin
+ b.combo_implemented?
+ rescue SystemExit => e
+ e.status.should == 1
+ end
+ $stdout.string.should include("This combination of parameters is not currently supported")
+ end
+ end
+ end
+ end
+end
\ No newline at end of file
--
1.7.4.4
12 years, 12 months
[PATCH aeolus 1/2] Refactored read file method into base command
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
.../image_factory/aeolus-image/lib/base_command.rb | 17 ++++++++
.../aeolus-image/lib/build_command.rb | 21 +++------
.../aeolus-image/spec/base_command_spec.rb | 44 ++++++++++++++-----
.../aeolus-image/spec/build_command_spec.rb | 24 -----------
4 files changed, 56 insertions(+), 50 deletions(-)
diff --git a/services/image_factory/aeolus-image/lib/base_command.rb b/services/image_factory/aeolus-image/lib/base_command.rb
index 54a5ac6..8776693 100644
--- a/services/image_factory/aeolus-image/lib/base_command.rb
+++ b/services/image_factory/aeolus-image/lib/base_command.rb
@@ -33,6 +33,23 @@ module Aeolus
create_resource('conductor')
end
+ def read_file(path)
+ begin
+ full_path = File.expand_path(path)
+ if File.exist?(full_path) && !File.directory?(full_path)
+ File.read(full_path)
+ else
+ return nil
+ end
+ rescue
+ nil
+ end
+ end
+
+ def quit(code)
+ exit(code)
+ end
+
private
def load_config
begin
diff --git a/services/image_factory/aeolus-image/lib/build_command.rb b/services/image_factory/aeolus-image/lib/build_command.rb
index e07059d..b8e511b 100644
--- a/services/image_factory/aeolus-image/lib/build_command.rb
+++ b/services/image_factory/aeolus-image/lib/build_command.rb
@@ -20,7 +20,11 @@ module Aeolus
def run
if combo_implemented?
- read_file
+ @options[:template_str] = read_file(@options[:template])
+ if @options[:template_str].nil?
+ quit(1)
+ 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]).each do |adaptor|
@@ -35,17 +39,6 @@ module Aeolus
end
end
- #TODO: Consider if this and the next method should be protected or private
- def read_file
- full_path = File.expand_path(@options[:template])
- if File.exist?(full_path) && !File.directory?(full_path)
- @options[:template_str] = File.read(File.expand_path(@options[:template]))
- else
- puts "Cannot find specified file"
- quit(1)
- end
- end
-
def combo_implemented?
if @options[:template].empty? || @options[:target].empty?
puts "This combination of parameters is not currently supported"
@@ -54,11 +47,11 @@ module Aeolus
true
end
- private
def quit(code)
@console.shutdown
- exit(code)
+ super
end
+
end
end
end
diff --git a/services/image_factory/aeolus-image/spec/base_command_spec.rb b/services/image_factory/aeolus-image/spec/base_command_spec.rb
index 69e0697..87f91e7 100644
--- a/services/image_factory/aeolus-image/spec/base_command_spec.rb
+++ b/services/image_factory/aeolus-image/spec/base_command_spec.rb
@@ -3,20 +3,40 @@ require 'spec_helper'
module Aeolus
module Image
describe BaseCommand do
- describe BaseCommand do
- it "should determine the correct credentials for HTTP Authentication" do
- basec = BaseCommand.new
- iwhd = basec.send :iwhd
- iwhd.user.should == nil
+ before(:each) do
+ @stdout_orig = $stdout
+ $stdout = StringIO.new
+ end
+
+ it "should determine the correct credentials for HTTP Authentication" do
+ basec = BaseCommand.new
+ iwhd = basec.send :iwhd
+ iwhd.user.should == nil
+
+ conductor = basec.send :conductor
+ conductor.user.should == "admin"
+ conductor.password.should == "password"
+
+ basec = BaseCommand.new({'username' => "testusername", 'password'=> "testpassword"})
+ conductor = basec.send :conductor
+ conductor.user.should == "testusername"
+ conductor.password.should == "testpassword"
+ end
+
+ describe "#read_file" do
+ after(:each) do
+ #(a)b.console.shutdown
+ end
- conductor = basec.send :conductor
- conductor.user.should == "admin"
- conductor.password.should == "password"
+ it "should return nil when it cannot find file" do
+ b = BaseCommand.new
+ b.send(:read_file, "foo.fake").should == nil
+ end
- basec = BaseCommand.new({'username' => "testusername", 'password'=> "testpassword"})
- conductor = basec.send :conductor
- conductor.user.should == "testusername"
- conductor.password.should == "testpassword"
+ it "should read file content into string variable" do
+ b = BaseCommand.new
+ template_str = b.send(:read_file, 'spec/sample_data/custom_repo.tdl')
+ template_str.should include("<template>")
end
end
end
diff --git a/services/image_factory/aeolus-image/spec/build_command_spec.rb b/services/image_factory/aeolus-image/spec/build_command_spec.rb
index 11182bf..24a769d 100644
--- a/services/image_factory/aeolus-image/spec/build_command_spec.rb
+++ b/services/image_factory/aeolus-image/spec/build_command_spec.rb
@@ -43,30 +43,6 @@ module Aeolus
end
end
- describe "#read_file" do
- after(:each) do
- #(a)b.console.shutdown
- end
-
- it "should give user explanation of missing file and exit" do
- @options[:template] = 'foo.fake'
- b = BuildCommand.new(@options, @output)
- begin
- b.read_file
- rescue SystemExit => e
- e.status.should == 1
- end
- $stdout.string.should include("Cannot find specified file")
- end
-
- it "should set the @options[:template_str] to file content for a valid file" do
- b = BuildCommand.new(@options, @output)
- b.read_file
- b.options[:template_str].should include("<template>")
- b.console.shutdown
- end
- end
-
describe "#combo_implemented?" do
it "should give useful feedback if no template or target is specified" do
@options[:template] = ''
--
1.7.4
12 years, 12 months
Finish touch-up of administer sections
by Jirka Tomasek
Added new UI elements for views where is new UI specified, Fixed bug
where Admin section select element was hidden when no breadcrumbs were
displayed.
12 years, 12 months
[PATCH conductor] Record and show history of instance changes
by Tomas Sedovic
From: Tomas Sedovic <tsedovic(a)redhat.com>
https://www.aeolusproject.org/redmine/issues/1633
---
src/app/models/instance_observer.rb | 12 ++++++++++++
src/app/views/instances/_history.haml | 5 +++++
src/features/instance.feature | 6 ++++++
src/spec/models/instance_observer_spec.rb | 20 ++++++++++++++++++++
4 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/src/app/models/instance_observer.rb b/src/app/models/instance_observer.rb
index 365efca..eedf813 100644
--- a/src/app/models/instance_observer.rb
+++ b/src/app/models/instance_observer.rb
@@ -61,6 +61,12 @@ class InstanceObserver < ActiveRecord::Observer
end
end
+ def after_create(instance)
+ event = Event.new(:source => instance, :event_time => instance.created_at,
+ :summary => "created")
+ event.save!
+ end
+
def after_update(instance)
# we try to generate unique key only when instance is running
# and provider_account for this instance has instance_key (provider account
@@ -69,6 +75,12 @@ class InstanceObserver < ActiveRecord::Observer
not instance.instance_key and instance.provider_account and instance.provider_account.instance_key
instance.delay.create_unique_key
end
+
+ if instance.state_changed?
+ event = Event.new(:source => instance, :event_time => DateTime.now,
+ :summary => "state changed to #{instance.state}")
+ event.save!
+ end
end
end
diff --git a/src/app/views/instances/_history.haml b/src/app/views/instances/_history.haml
index 854743e..313d3a5 100644
--- a/src/app/views/instances/_history.haml
+++ b/src/app/views/instances/_history.haml
@@ -1,3 +1,8 @@
%h3
History for
= @instance.name
+%ul
+ - @instance.events.each do |event|
+ %li
+ = @instance.name
+ = event.summary
diff --git a/src/features/instance.feature b/src/features/instance.feature
index d9e830a..c110c8d 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -207,3 +207,9 @@ Feature: Manage Instances
And I accept JSON
When I stop "mock1" instance
Then I should get back JSON object with success and errors
+
+ Scenario: Show instance history
+ Given a mock running instance exists
+ And I am viewing the mock instance detail
+ When I follow "history"
+ Then I should see "created" within "#details-selected"
diff --git a/src/spec/models/instance_observer_spec.rb b/src/spec/models/instance_observer_spec.rb
index 1f64dd5..767712b 100644
--- a/src/spec/models/instance_observer_spec.rb
+++ b/src/spec/models/instance_observer_spec.rb
@@ -168,4 +168,24 @@ describe InstanceObserver do
@instance.save!
@instance.instance_key.name.should != @provider_account.instance_key.name
end
+
+
+ it "should track the events of the instance lifetime" do
+ @instance.events.should have(1).items
+ @instance.events[0].summary.should match /created/
+
+ @instance.state = Instance::STATE_RUNNING
+ @instance.save!
+
+ @instance = Instance.find((a)instance.id)
+ @instance.events.should have(2).items
+ @instance.events[1].summary.should match /state.*running/
+
+ @instance.state = Instance::STATE_STOPPED
+ @instance.save!
+
+ @instance = Instance.find((a)instance.id)
+ @instance.events.should have(3).items
+ @instance.events[2].summary.should match /state.*stopped/
+ end
end
--
1.7.4.4
12 years, 12 months
Status code for invalid PUT data?
by Justin Clift
Hi Greg,
Did an initial conversion of the Audrey_Overview wiki page into
proper Aeolus site content.
When reading over the status codes for given back by the config
server, noticed they don't seem to cater for invalid PUT data
being passed:
http://justinclift.fedorapeople.org/assemblies/audrey.html#table3
i.e. badly formatted/wrong type values, or perhaps values being
supplied for something that wasn't asked for, etc.
Kind of thinking it's probably worth at least catering to, at
least for the security minded people out there that like to see
what breaks when passing fuzzed data. ;)
What do you reckon?
(note, that page is on the dev site, as I have a feeling the
content will need updating to reflect usage of CLI tools instead
of Conductor in the short term)
Regards and best wishes,
Justin Clift
--
Aeolus Community Manager
http://www.aeolusproject.org
12 years, 12 months
[PATCH aeolus 1/2] Refactored read file method into base command
by Martyn Taylor
From: Martyn Taylor <mtaylor(a)redhat.com>
---
.../image_factory/aeolus-image/lib/base_command.rb | 18 +++++++
.../aeolus-image/lib/build_command.rb | 20 +++-----
.../aeolus-image/spec/base_command_spec.rb | 49 +++++++++++++++-----
.../aeolus-image/spec/build_command_spec.rb | 24 ----------
4 files changed, 62 insertions(+), 49 deletions(-)
diff --git a/services/image_factory/aeolus-image/lib/base_command.rb b/services/image_factory/aeolus-image/lib/base_command.rb
index 54a5ac6..f6cfbba 100644
--- a/services/image_factory/aeolus-image/lib/base_command.rb
+++ b/services/image_factory/aeolus-image/lib/base_command.rb
@@ -33,6 +33,24 @@ module Aeolus
create_resource('conductor')
end
+ def read_file(path)
+ begin
+ full_path = File.expand_path(path)
+ if File.exist?(full_path) && !File.directory?(full_path)
+ File.read(full_path)
+ else
+ raise "Error Reading File"
+ end
+ rescue
+ puts "Cannot find specified file: " + path
+ nil
+ end
+ end
+
+ def quit(code)
+ exit(code)
+ end
+
private
def load_config
begin
diff --git a/services/image_factory/aeolus-image/lib/build_command.rb b/services/image_factory/aeolus-image/lib/build_command.rb
index b3765ae..b8e511b 100644
--- a/services/image_factory/aeolus-image/lib/build_command.rb
+++ b/services/image_factory/aeolus-image/lib/build_command.rb
@@ -20,7 +20,11 @@ module Aeolus
def run
if combo_implemented?
- read_file
+ @options[:template_str] = read_file(@options[:template])
+ if @options[:template_str].nil?
+ quit(1)
+ 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]).each do |adaptor|
@@ -35,16 +39,6 @@ module Aeolus
end
end
- def read_file
- full_path = File.expand_path(@options[:template])
- if File.exist?(full_path) && !File.directory?(full_path)
- @options[:template_str] = File.read(File.expand_path(@options[:template]))
- else
- puts "Cannot find specified file"
- quit(1)
- end
- end
-
def combo_implemented?
if @options[:template].empty? || @options[:target].empty?
puts "This combination of parameters is not currently supported"
@@ -53,11 +47,11 @@ module Aeolus
true
end
- private
def quit(code)
@console.shutdown
- exit(code)
+ super
end
+
end
end
end
diff --git a/services/image_factory/aeolus-image/spec/base_command_spec.rb b/services/image_factory/aeolus-image/spec/base_command_spec.rb
index 69e0697..b434ef8 100644
--- a/services/image_factory/aeolus-image/spec/base_command_spec.rb
+++ b/services/image_factory/aeolus-image/spec/base_command_spec.rb
@@ -3,20 +3,45 @@ require 'spec_helper'
module Aeolus
module Image
describe BaseCommand do
- describe BaseCommand do
- it "should determine the correct credentials for HTTP Authentication" do
- basec = BaseCommand.new
- iwhd = basec.send :iwhd
- iwhd.user.should == nil
+ before(:each) do
+ @stdout_orig = $stdout
+ $stdout = StringIO.new
+ end
+
+ it "should determine the correct credentials for HTTP Authentication" do
+ basec = BaseCommand.new
+ iwhd = basec.send :iwhd
+ iwhd.user.should == nil
+
+ conductor = basec.send :conductor
+ conductor.user.should == "admin"
+ conductor.password.should == "password"
+
+ basec = BaseCommand.new({'username' => "testusername", 'password'=> "testpassword"})
+ conductor = basec.send :conductor
+ conductor.user.should == "testusername"
+ conductor.password.should == "testpassword"
+ end
+
+ describe "#read_file" do
+ after(:each) do
+ #(a)b.console.shutdown
+ end
- conductor = basec.send :conductor
- conductor.user.should == "admin"
- conductor.password.should == "password"
+ it "should give user explanation of missing file and exit" do
+ b = BaseCommand.new
+ begin
+ b.send(:read_file, "foo.fake")
+ rescue SystemExit => e
+ e.status.should == 1
+ end
+ $stdout.string.should include("Cannot find specified file: foo.fake")
+ end
- basec = BaseCommand.new({'username' => "testusername", 'password'=> "testpassword"})
- conductor = basec.send :conductor
- conductor.user.should == "testusername"
- conductor.password.should == "testpassword"
+ it "should read file content into string variable" do
+ b = BaseCommand.new
+ template_str = b.send(:read_file, 'spec/sample_data/custom_repo.tdl')
+ template_str.should include("<template>")
end
end
end
diff --git a/services/image_factory/aeolus-image/spec/build_command_spec.rb b/services/image_factory/aeolus-image/spec/build_command_spec.rb
index 11182bf..24a769d 100644
--- a/services/image_factory/aeolus-image/spec/build_command_spec.rb
+++ b/services/image_factory/aeolus-image/spec/build_command_spec.rb
@@ -43,30 +43,6 @@ module Aeolus
end
end
- describe "#read_file" do
- after(:each) do
- #(a)b.console.shutdown
- end
-
- it "should give user explanation of missing file and exit" do
- @options[:template] = 'foo.fake'
- b = BuildCommand.new(@options, @output)
- begin
- b.read_file
- rescue SystemExit => e
- e.status.should == 1
- end
- $stdout.string.should include("Cannot find specified file")
- end
-
- it "should set the @options[:template_str] to file content for a valid file" do
- b = BuildCommand.new(@options, @output)
- b.read_file
- b.options[:template_str].should include("<template>")
- b.console.shutdown
- end
- end
-
describe "#combo_implemented?" do
it "should give useful feedback if no template or target is specified" do
@options[:template] = ''
--
1.7.4
12 years, 12 months
[PATCH] various cucumber fixes
by Scott Seago
Most cucumber tests pass now. Most of the legacy image/template/etc stuff is removed from cucumber tests, and deployment/instance bits updated to use new model.
There's only one test that's still failing:
expected the following element's content to include "mockdeployment":
Instances
(Spec::Expectations::ExpectationNotMetError)
./features/step_definitions/web_steps.rb:151:in `/^(?:|I )should see "([^"]*)"$/'
features/deployment.feature:122:in `And I should see "mockdeployment"'
This test was passing before the last rebase, but in any case it seems to relate to the new js partial returns.
Signed-off-by: Scott Seago <sseago(a)redhat.com>
---
src/app/controllers/instances_controller.rb | 4 +-
src/app/views/instances/_properties.haml | 14 +-
src/features/api.feature | 1 -
src/features/deployment.feature | 52 ++---
src/features/image_import.feature | 40 ----
src/features/instance.feature | 21 +--
src/features/legacy_deployable.feature | 116 ----------
src/features/legacy_deployable_permissions.feature | 74 -------
src/features/legacy_template.feature | 228 --------------------
src/features/pool.feature | 1 -
src/features/provider.feature | 3 -
src/features/provider_account.feature | 1 -
src/features/step_definitions/deployment_steps.rb | 8 +-
src/features/step_definitions/instance_steps.rb | 8 +-
.../step_definitions/legacy_assembly_steps.rb | 25 ---
.../step_definitions/legacy_deployable_steps.rb | 35 ---
.../step_definitions/legacy_template_steps.rb | 130 -----------
src/features/step_definitions/pool_steps.rb | 5 +-
src/features/step_definitions/provider_steps.rb | 8 -
src/features/suggested_deployables.feature | 1 -
src/spec/factories/deployment.rb | 1 -
src/spec/factories/instance.rb | 8 +-
22 files changed, 46 insertions(+), 738 deletions(-)
delete mode 100644 src/features/image_import.feature
delete mode 100644 src/features/legacy_deployable.feature
delete mode 100644 src/features/legacy_deployable_permissions.feature
delete mode 100644 src/features/legacy_template.feature
delete mode 100644 src/features/step_definitions/legacy_assembly_steps.rb
delete mode 100644 src/features/step_definitions/legacy_deployable_steps.rb
delete mode 100644 src/features/step_definitions/legacy_template_steps.rb
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index 8f2880a..88fda19 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -299,8 +299,8 @@ class InstancesController < ApplicationController
@hardware_profiles = HardwareProfile.all(
:include => :architecture,
:conditions => {
- :provider_id => nil,
- 'hardware_profile_properties.value' => @instance.legacy_template.architecture
+ :provider_id => nil
+ #FIXME arch?
}
)
end
diff --git a/src/app/views/instances/_properties.haml b/src/app/views/instances/_properties.haml
index ab9d4a2..38b3ecc 100644
--- a/src/app/views/instances/_properties.haml
+++ b/src/app/views/instances/_properties.haml
@@ -14,17 +14,9 @@
%li
= label_tag :private_addresses, 'Private Addresses'
%span= @instance.private_addresses
- - if @instance.legacy_template
- %li
- = label_tag :operating_system, 'Operating system'
- %span= "#{(a)instance.legacy_template.xml.platform} #{(a)instance.legacy_template.xml.platform_version}"
- %li
- = label_tag :base_legacy_template, 'Base Template'
- %span= @instance.legacy_template.name
- - else
- %li
- = label_tag :assembly, 'Assembly'
- %span= @instance.assembly_xml ? @instance.assembly_xml.name : ''
+ %li
+ = label_tag :assembly, 'Assembly'
+ %span= @instance.assembly_xml.name
%li
= label_tag :provider, 'Provider'
%span= @instance.provider_account.provider.name if @instance.provider_account
diff --git a/src/features/api.feature b/src/features/api.feature
index 4651b8f..4ff624a 100644
--- a/src/features/api.feature
+++ b/src/features/api.feature
@@ -6,7 +6,6 @@ Feature: User authentication
Background:
Given I am an authorised user
And I am logged in
- And There is a mock pulp repository
Scenario: Check can start instance
Given there is a user "testuser"
diff --git a/src/features/deployment.feature b/src/features/deployment.feature
index ebbdcba..851ec46 100644
--- a/src/features/deployment.feature
+++ b/src/features/deployment.feature
@@ -25,33 +25,36 @@ Feature: Manage Deployments
And I should see "bob"
Scenario: Launch new deployment
- Given there is a deployable named "testdeployable"
- And There is a mock pulp repository
- And there is a "testtemplate" template
- And there is an assembly named "testassembly" belonging to "testdeployable"
- And there is an assembly named "testassembly" belonging to "testtemplate" template
- When I go to the deployments page
+ Given a pool "mockpool" exists
+ And there is "front_hwp1" conductor hardware profile
+ And there is "front_hwp2" conductor hardware profile
+ When I am viewing the pool "mockpool"
And I follow "New Deployment"
- Then I should see "Launch new deployment via"
- When I select "testdeployable" from "legacy_deployable_id"
+ Then I should see "New Deployment in mockpool"
+ When I fill in "deployable_url" with "http://localhost/deployables/deployable1.xml"
+ When I fill in "deployment_name" with "mynewdeployment"
+ When I press "Next"
+ Then I should see "Launch Summary"
When I press "Launch"
- Then I should see "Launch deployable"
-
+ Then I should see "Deployment launched"
+ Then I should see "mynewdeployment Deployment"
+
Scenario: Launch new deployment over XHR
- Given there is a deployable named "testdeployable"
- And There is a mock pulp repository
- And there is a "testtemplate" template
- And there is an assembly named "testassembly" belonging to "testdeployable"
- And there is an assembly named "testassembly" belonging to "testtemplate" template
+ Given a pool "mockpool" exists
+ And there is "front_hwp1" conductor hardware profile
+ And there is "front_hwp2" conductor hardware profile
+ When I am viewing the pool "mockpool"
And I request XHR
- When I go to the deployments page
And I follow "New Deployment"
- Then I should see "Launch new deployment via"
- And I should get back a partial
- When I select "testdeployable" from "legacy_deployable_id"
- When I press "Launch"
Then I should get back a partial
- And I should see "Launch deployable"
+ Then I should see "New Deployment in mockpool"
+ When I fill in "deployable_url" with "http://localhost/deployables/deployable1.xml"
+ When I fill in "deployment_name" with "mynewdeployment"
+ When I press "Next"
+ Then I should see "Launch Summary"
+ When I press "Launch"
+ Then I should see "Created"
+ Then I should see "mynewdeployment"
Scenario: Stop deployments
Given there is a deployment named "testdeployment" belonging to "testdeployable" owned by "testuser"
@@ -77,7 +80,6 @@ Feature: Manage Deployments
When I am on the deployments page
And I follow "testdeployment"
Then I should see "testdeployment"
- And I should see "Created:"
Scenario: Edit deployment name
Given there is a deployment named "Hudson" belonging to "QA Infrastructure" owned by "joe"
@@ -101,21 +103,18 @@ Feature: Manage Deployments
And I should see "Jenkins"
Scenario: View all deployments in JSON format
- Given There is a mock pulp repository
And there are 2 deployments
And I accept JSON
When I go to the deployments page
Then I should see 2 deployments in JSON format
Scenario: View a deployment in JSON format
- Given There is a mock pulp repository
And a deployment "mockdeployment" exists
And I accept JSON
When I am viewing the deployment "mockdeployment"
Then I should see deployment "mockdeployment" in JSON format
Scenario: View a deployment via XHR
- Given There is a mock pulp repository
And a deployment "mockdeployment" exists
And I request XHR
When I am viewing the deployment "mockdeployment"
@@ -123,20 +122,17 @@ Feature: Manage Deployments
And I should see "mockdeployment"
Scenario: Create a deployment and get JSON response
- Given There is a mock pulp repository
And I accept JSON
When I create a deployment
Then I should get back a deployment in JSON format
Scenario: Create a deployment and get XHR response
- Given There is a mock pulp repository
And I request XHR
When I create a deployment
Then I should get back a partial
Scenario: Stop a deployment
Given a deployment "mockdeployment" exists
- And There is a mock pulp repository
And I accept JSON
When I stop "mockdeployment" deployment
Then I should get back JSON object with success and errors
diff --git a/src/features/image_import.feature b/src/features/image_import.feature
deleted file mode 100644
index 248ec25..0000000
--- a/src/features/image_import.feature
+++ /dev/null
@@ -1,40 +0,0 @@
-Feature: Import Images
- In order to use other images in my cloud infrastructure
- As a user
- I want to import images from other providers
-
- Background:
- Given I am an authorised user
- And I am logged in
- And I am on the homepage
- And there is a provider named "testprovider"
- And there is a provider account named "provider1"
- And There is a mock pulp repository
- And Image Warehouse is running
- When I go to the new image import page
- Then I should be on the new image import page
-
-
- Scenario: Import a new image
- When I select "provider1" from "provider_account_id"
- And I fill in "ami_id" with "img1"
- Given I press "Import"
- Then I should see "Image successfully imported"
- And I should be on the legacy_templates page
-
- Scenario: Import an already imported image
- When I select "provider1" from "provider_account_id"
- And I fill in "ami_id" with "img1"
- Given I press "Import"
- When I go to the new image import page
- When I select "provider1" from "provider_account_id"
- And I fill in "ami_id" with "img1"
- And I press "Import"
- Then I should see "Image 'img1' is already imported"
- And I should be on the image imports page
-
- Scenario: Import a non-existent image
- When I select "provider1" from "provider_account_id"
- And I fill in "ami_id" with "does-not-exist"
- Given I press "Import"
- Then I should see "Could not import image"
diff --git a/src/features/instance.feature b/src/features/instance.feature
index 11846a3..d9e830a 100644
--- a/src/features/instance.feature
+++ b/src/features/instance.feature
@@ -7,7 +7,6 @@ Feature: Manage Instances
Background:
Given I am an authorised user
And I am logged in
- And There is a mock pulp repository
Scenario: Download an Instance Key
Given a mock running instance exists
@@ -51,31 +50,13 @@ Feature: Manage Instances
Then I should get back a partial
And I should see "mock1"
- Scenario: Launch instance
- Given there is an uploaded image for a template
- And I am on the instances page
- And there is "mock_profile" conductor hardware profile
- And there is "mock_realm" frontend realm
- And there is "mock_pool" pool
- When I press "Create"
- Then I should see "Show Templates"
- When I press "Launch"
- Then I should be on the new instance page
- When I fill in "instance_name" with "mock1"
- And I select "mock_profile" from "instance_hardware_profile_id"
- And I select "mock_pool" from "instance_pool_id"
- And I select "mock_realm" from "instance_frontend_realm_id"
- And I press "Launch"
- Then I should be on the instances page
- And I should see "mock1"
-
Scenario: Show instance details
Given there is a "mock1" instance
And I am on the instances page
When I follow "mock1"
And I should see "Name"
And I should see "Status"
- And I should see "Base Template"
+ And I should see "Assembly"
Scenario: Show instance details over XHR
Given there is a "mock1" instance
diff --git a/src/features/legacy_deployable.feature b/src/features/legacy_deployable.feature
deleted file mode 100644
index b6062fb..0000000
--- a/src/features/legacy_deployable.feature
+++ /dev/null
@@ -1,116 +0,0 @@
-Feature: Manage Deployables
- In order to manage my cloud infrastructure
- As a user
- I want to manage deployables
-
- Background:
- Given I am an authorised user
- And I am logged in
- And There is a mock pulp repository
-
- Scenario: List deployables
- Given I am on the homepage
- And there is a deployable named "MySQL cluster"
- When I go to the legacy_deployables page
- Then I should see "MySQL cluster"
-
- Scenario: Create a new Deployable
- Given there is a deployable named "MySQL cluster"
- And I am on the legacy_deployables page
- When I follow "Create"
- Then I should be on the new legacy_deployable page
- And I should see "New Deployable"
- When I fill in "legacy_deployable[name]" with "App"
- And I press "Save"
- Then I should be on App's deployable page
- And I should see "Deployable added"
- And I should have a deployable named "App"
- And I should see "App"
-
- Scenario: Edit a deployable
- Given there is a deployable named "MySQL cluster"
- And I am on the legacy_deployables page
- When I follow "MySQL cluster"
- And I follow "Edit"
- Then I should be on the edit legacy_deployable page
- And I should see "Editing Deployable"
- When I fill in "legacy_deployable[name]" with "AppModified"
- And I press "Save"
- Then I should be on AppModified's deployable page
- And I should see "Deployable updated"
- And I should have a deployable named "AppModified"
- And I should see "AppModified"
-
- Scenario: Delete a deployable
- Given there is a deployable named "App"
- And I am on the legacy_deployables page
- When I check the "App" deployable
- And I press "Delete"
- Then I should be on the legacy_deployables page
- And there should be no deployables
-
- Scenario: Add an assembly to a deployable
- Given there is a deployable named "Webserver"
- Given there is an assembly named "Apache"
- And I am on the legacy_deployables page
- When I follow "Webserver"
- And I follow "details_Assemblies"
- And I follow "Add Assembly..."
- Then I should see "Apache"
- When I check the "Apache" assembly
- And I press "Save"
- Then I should see "Assemblies saved."
- And I should see "Apache"
-
- Scenario: Remove an assembly from a deployable
- Given there is a deployable named "Webserver"
- Given there is an assembly named "Apache" belonging to "Webserver"
- And I am on the legacy_deployables page
- When I follow "Webserver"
- And I follow "details_Assemblies"
- Then I should see "Apache"
- When I check the "Apache" assembly
- And I press "Remove Selected"
- Then I should see "Assemblies removed."
- And I should not see "Apache"
-
- Scenario: Search for deployables
- Given there is a deployable named "first"
- And there is a deployable named "second"
- And I am on the legacy_deployables page
- Then I should see "first"
- And I should see "second"
- When I fill in "q" with "first"
- And I press "Search"
- Then I should see "first"
- And I should not see "second"
- When I fill in "q" with "second"
- And I press "Search"
- Then I should see "second"
- And I should not see "first"
- When I fill in "q" with ""
- And I press "Search"
- Then I should see "first"
- And I should see "second"
-
- Scenario: Show list of deployments belongs to deployable
- Given there is a deployable named "My"
- And there are deployment named "My deployment" belongs to "My"
- When I am on the deployable deployments page
- Then I should see "My deployment"
-
- Scenario: Create and launch a deployment from a deployable
- Given there is a factory deployable named "test1"
- And I am on the legacy_deployables page
- And there is "mock_profile" conductor hardware profile
- And there is "mock_realm" frontend realm
- And there is "mock_pool" pool
- When I follow "test1"
- And I follow "Launch"
- Then I should be on the legacy new deployments page
- When I fill in "deployment_name" with "depl1"
- And I select "mock_pool" from "deployment_pool_id"
- And I select "mock_realm" from "deployment_frontend_realm_id"
- And I select default hardware profile for assemblies in "test1"
- And I press "Launch"
- Then I should see "Deployment launched"
diff --git a/src/features/legacy_deployable_permissions.feature b/src/features/legacy_deployable_permissions.feature
deleted file mode 100644
index d556151..0000000
--- a/src/features/legacy_deployable_permissions.feature
+++ /dev/null
@@ -1,74 +0,0 @@
-Feature: Manage Deployables as a non-admin
- In order to manage my cloud infrastructure
- As an unprivileged user
- I want to manage deployables that I have permission to use
-
- Background:
- Given I am a new user
-
- Scenario: List deployables as a new user
- Given I am on the homepage
- And there is a deployable named "MySQL cluster"
- When I go to the legacy_deployables page
- Then I should see "MySQL cluster"
-
- Scenario: View an existing deployable as a new user
- Given there is a deployable named "MySQL cluster"
- And I am on the legacy_deployables page
- When I follow "MySQL cluster"
- Then I should see "Edit"
-
- @allow-rescue
- Scenario: Try to edit an existing deployable as a new user
- Given there is a deployable named "Apache Webserver"
- And I am on the legacy_deployables page
- When I follow "Apache Webserver"
- And I follow "Edit"
- Then I should see "You have insufficient privileges to perform action."
-
- Scenario: Edit a deployable I created
- Given I am on the legacy_deployables page
- When I follow "Create"
- Then I should be on the new legacy deployable page
- And I should see "New Deployable"
- When I fill in "legacy_deployable[name]" with "Mahout Server"
- And I press "Save"
- Then I should be on App's deployable page
- And I should see "Deployable added"
- And I should have a deployable named "Mahout Server"
- And I should see "Mahout Server"
- When I follow "Mahout Server"
- And I follow "Edit"
- Then I should be on the edit legacy deployable page
- And I should see "Editing Deployable"
- When I fill in "legacy_deployable[name]" with "MahoutModified"
- And I press "Save"
- Then I should be on MahoutModified's deployable page
- And I should see "Deployable updated"
- And I should have a deployable named "MahoutModified"
- And I should see "MahoutModified"
-
- Scenario: Create a deployable as a new user
- And I am on the legacy_deployables page
- When I follow "Create"
- Then I should be on the new legacy deployable page
- And I should see "New Deployable"
- When I fill in "legacy_deployable[name]" with "Solr Server"
- And I press "Save"
- Then I should be on App's deployable page
- And I should see "Deployable added"
- And I should have a deployable named "Solr Server"
- And I should see "Solr Server"
-
- @allow-rescue
- Scenario: Try to remove an existing assembly as a new user
- Given there is a deployable named "Mailserver Cluster"
- Given there is an assembly named "Postfix Node" belonging to "Mailserver Cluster"
- And I am on the legacy_deployables page
- Then I should see "Mailserver Cluster"
- When I follow "Mailserver Cluster"
- And I follow "details_Assemblies"
- Then I should see "Postfix Node"
- When I check the "Postfix Node" assembly
- And I press "Remove Selected"
- Then I should see "You have insufficient privileges to perform action."
diff --git a/src/features/legacy_template.feature b/src/features/legacy_template.feature
deleted file mode 100644
index c4648f9..0000000
--- a/src/features/legacy_template.feature
+++ /dev/null
@@ -1,228 +0,0 @@
-Feature: Manage Templates
- In order to manage my cloud infrastructure
- As a user
- I want to manage legacy_templates
-
- Background:
- Given I am an authorised user
- And I am logged in
- And There is a mock pulp repository
-
- Scenario: Create a new Template
- Given I am on the templates page
- When I follow "Create"
- Then I should be on the new template page
- When I fill in the following:
- | tpl_name | mocktemplate |
- | tpl_platform | fedora13 |
- | tpl_summary | mockdesc |
- When I press "Save"
- Then I should be on the templates page
- And I should see "Template saved"
- And I should see "mocktemplate"
-
- Scenario: Add a package to a new template
- Given I am on the new template page
- When I press "Add Software"
- When I press "admin-tools"
- Then I should see "System Tools"
- And I should see "libdeltacloud"
- When I check "libdeltacloud"
- And I press "Add Selected"
- Then I should see "New Template"
- And I should see "libdeltacloud"
-
- Scenario: Add a searched package to a new template
- Given I am on the new template page
- When I press "Add Software"
- And I fill in "package_search" with "libdeltacloud"
- And I press "package_search_button"
- Then I should see "libdeltacloud"
- When I check "libdeltacloud"
- And I press "Add Selected"
- Then I should see "New Template"
- And I should see "libdeltacloud"
-
- Scenario: Add group and remove package to/from the template
- Given I am on the templates page
- When I follow "Create"
- Then I should be on the new template page
- When I fill in the following:
- | tpl_name | mocktemplate |
- And I press "Add Software"
- Then I should see "Managed Content Selection"
- When I press "Collections"
- And I check "group_system-tools"
- And I press "Add Selected"
- Then I should see "Managed Content to Bundle"
- And the "tpl[name]" field by name should contain "mocktemplate"
- And the page should contain "#package_libdeltacloud" selector
- When I press "remove_package_libdeltacloud"
- Then I should see "Managed Content to Bundle"
- And the page should not contain "#package_libdeltacloud" selector
- When I press "Save"
- Then I should be on the templates page
- And I should see "Template saved"
- And I should see "mocktemplate"
-
- Scenario: Add group of packages to existing template
- Given there is a "mock1" template
- And has package "deltacloud-aggregator"
- When I edit the template
- And I press "Add Software"
- Then I should see "Managed Content Selection"
- When I press "Collections"
- And I check "group_system-tools"
- And I press "Add Selected"
- Then I should see "Managed Content to Bundle"
- And the page should contain "#package_libdeltacloud" selector
- When I press "Save"
- Then I should be on the templates page
- And I should see "Template updated"
- When I edit the template
- Then the page should contain "#package_libdeltacloud" selector
-
- Scenario: Sorting legacy_templates
- Given there is a "mock1" template
- And there is a "mock2" template
- And I am on the templates page
- When I follow "Name" within "#legacy_templates_table"
- Then I should see "mock1" followed by "mock2"
- When I follow "Name" within "#legacy_templates_table"
- Then I should see "mock2" followed by "mock1"
-
- Scenario: Sorting template builds
- Given there is a "mock1" build
- And there is a "mock2" build
- And I am on the template builds page
- When I follow "Name"
- Then I should see "mock1" followed by "mock2"
- When I follow "Name"
- Then I should see "mock2" followed by "mock1"
-
- Scenario: Search software with empty string
- Given I am on the new template page
- When I press "Add Software"
- And I fill in "package_search" with ""
- And I press "package_search_button"
- Then I should see "Search string is empty"
-
- Scenario: Show software selection
- Given I am on the new template page
- And I press "Add Software"
- Then I should see an input "Collections"
- # test that we see a metagroup
- Then I should see an input "admin-tools"
- # test that we see a collection (collections are loaded by default)
- And I should see an input "system-tools"
-
- Scenario: See upload status
- Given there is a "mock1" template
- And there is Amazon AWS build and push for this template
- And I am on the templates page
- When I choose this template
- And I follow "Builds"
- Then I should see "amazon-ec2: complete"
-
- Scenario: Build template
- Given there is a "mock1" template
- And there is Amazon AWS provider account
- And I am on the templates page
- When I choose this template
- And I follow "Builds"
- Then I should see "Builds for"
- When I select "Amazon EC2" from "target"
- And I press "Go"
- Then I should be on the legacy_template page
- And I should see "mock1"
-
- Scenario: Upload image
- Given there is a "mock1" template
- And I am on the templates page
- And there is Amazon AWS build for this template
- And there is Amazon AWS provider
- And I am on the templates page
- When I choose this template
- And I follow "Builds"
- Then I should see "amazon-ec2: not uploaded upload"
- When I follow "upload"
- Then I should see "Builds"
- # TODO: fix status once uploaded field is replaced by status field
- And I should see "amazon-ec2: queued"
-
- Scenario: Build imported template
- Given there is an imported template
- And there is Amazon AWS provider account
- And I am on the templates page
- When I choose this template
- And I follow "Builds"
- Then I should see "Build imported template is not supported"
-
- Scenario: Search for legacy_templates
- Given there are these legacy_templates:
- | name | platform | platform_version | architecture | summary |
- | Test1 | fedora13 | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
- | Mock | fedora14 | 14 | i386 | Test Template Fedora 14 Description |
- | Other | fedora14 | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
- And I am on the templates page
- Then I should see the following:
- | NAME | OS | VERSION | ARCH |
- | Test1 | Fedora | 13 | x86_64 |
- | Mock | Fedora | 14 | i386 |
- | Other | Fedora | 10.04 | i386 |
- When I fill in "q" with "test"
- And I press "Search"
- Then I should see "Test1"
- And I should see "Mock"
- And I should see "Other"
- When I fill in "q" with "Mock"
- And I press "Search"
- Then I should see "Mock"
- And I should not see "Test1"
- And I should not see "Other"
- When I fill in "q" with "13"
- And I press "Search"
- Then I should see "Test1"
- And I should not see "Other"
- And I should not see "Mock"
- When I fill in "q" with "x86_64"
- And I press "Search"
- Then I should see "Test1"
- And I should not see "Other"
- And I should not see "Mock"
- When I fill in "q" with "fedora"
- And I press "Search"
- Then I should see "Test1"
- And I should see "Other"
- And I should see "Mock"
- When I fill in "q" with "32 bit Description"
- And I press "Search"
- Then I should not see "Test1"
- And I should see "Other"
- And I should not see "Mock"
-
- Scenario: Delete multiple legacy_templates
- Given there are these legacy_templates:
- | name | platform | platform_version | architecture | summary |
- | Test1 | fedora13 | 13 | x86_64 | Test Template Fedora 13 64 bit Description |
- | Mock | fedora13 | 14 | i386 | Test Template Fedora 14 Description |
- | Other | fedora13 | 10.04 | i386 | Test Template Ubuntu 10.04 32 bit Description |
- And I am on the templates page
- When I check "Test1" template
- And I check "Mock" template
- And I press "Delete"
- Then I should be on the templates page
- And I should see "Other"
-
- Scenario: Create Assembly and Deployable
- Given I am on the new template page
- When I fill in the following:
- | tpl_name | mocktemplate |
- | tpl_platform | fedora13 |
- | tpl_summary | mockdesc |
- And I check "create_deployable"
- And I press "Save"
- Then I should be on the templates page
- And I should see "mocktemplate"
- When I go to the legacy_deployables page
- And I should see "mocktemplate"
diff --git a/src/features/pool.feature b/src/features/pool.feature
index ef00e15..189bd6a 100644
--- a/src/features/pool.feature
+++ b/src/features/pool.feature
@@ -171,7 +171,6 @@ Feature: Manage Pools
Then I should see "Your Pools" within "section.pools"
Scenario: Display alerts
- Given There is a mock pulp repository
And there is a "fail1" failed instance
When I go to the pools page
Then I should see "Alerts"
diff --git a/src/features/provider.feature b/src/features/provider.feature
index c49379c..ef89ea5 100644
--- a/src/features/provider.feature
+++ b/src/features/provider.feature
@@ -6,7 +6,6 @@ Feature: Manage Providers
Background:
Given I am an authorised user
And I am logged in
- And There is a mock pulp repository
Scenario: List providers
Given I am on the homepage
@@ -75,7 +74,6 @@ Feature: Manage Providers
Scenario: Delete a provider
Given I am on the homepage
And there is a provider named "provider1"
- And this provider has 5 provider images
And this provider has 5 hardware profiles
And this provider has a realm
And this provider has a provider account
@@ -83,7 +81,6 @@ Feature: Manage Providers
And I check "provider1" provider
And I press "Delete"
And there should not exist a provider named "provider1"
- And there should not be any provider images
And there should not be any hardware profiles
And there should not be a provider account
And there should not be a realm
diff --git a/src/features/provider_account.feature b/src/features/provider_account.feature
index d25ec0a..8debb58 100644
--- a/src/features/provider_account.feature
+++ b/src/features/provider_account.feature
@@ -6,7 +6,6 @@ Feature: Manage Provider Accounts
Background:
Given I am an authorised user
And I am logged in
- And There is a mock pulp repository
Scenario: List provider accounts
Given I am on the homepage
diff --git a/src/features/step_definitions/deployment_steps.rb b/src/features/step_definitions/deployment_steps.rb
index b1d516c..6384630 100644
--- a/src/features/step_definitions/deployment_steps.rb
+++ b/src/features/step_definitions/deployment_steps.rb
@@ -1,7 +1,8 @@
Given /^there is a deployment named "([^"]*)" belonging to "([^"]*)" owned by "([^"]*)"$/ do |deployment_name, deployable_name, owner_name|
user = Factory(:user, :login => owner_name, :last_name => owner_name)
- deployable = LegacyDeployable.create!(:name => deployable_name, :owner => user)
- @deployment = Deployment.create!({:name => deployment_name, :pool => Pool.first, :owner => user, :legacy_deployable_id => deployable.id})
+ @deployment = Deployment.new({:name => deployment_name, :pool => Pool.first, :owner => user})
+ @deployment.import_xml_from_url("http://localhost/deployables/deployable1.xml")
+ @deployment.save
end
When /^I check "([^"]*)" deployment/ do |name|
@@ -38,9 +39,8 @@ end
When /^I create a deployment$/ do
deployment = Factory.build :deployment
deployment.pool.save!
- deployment.legacy_deployable.save!
visit(deployments_url, :post, 'deployment[name]' => deployment.name,
- 'deployment[pool_id]' => deployment.pool.id, 'deployment[legacy_deployable_id]' => deployment.legacy_deployable.id)
+ 'deployment[pool_id]' => deployment.pool.id, 'deployment[deployable_xml]' => deployment[:deployable_xml])
end
Then /^I should get back a deployment in JSON format$/ do
diff --git a/src/features/step_definitions/instance_steps.rb b/src/features/step_definitions/instance_steps.rb
index bb72234..a181c62 100644
--- a/src/features/step_definitions/instance_steps.rb
+++ b/src/features/step_definitions/instance_steps.rb
@@ -55,12 +55,8 @@ Given /^there is a "([^"]*)" stopped instance$/ do |name|
Factory :instance, :name => name, :state => Instance::STATE_STOPPED
end
-Given /^there is an uploaded image for a template$/ do
- Factory :legacy_provider_image
-end
-
Given /^there is "([^"]*)" conductor hardware profile$/ do |name|
- Factory :mock_hwp2, :name => name
+ Factory :front_hwp1, :name => name
end
Given /^there is "([^"]*)" frontend realm$/ do |name|
@@ -120,7 +116,7 @@ end
When /^I create mock instance$/ do
inst = Factory.build :mock_running_instance
- visit instances_url, :post, 'instance[name]' => inst.name, 'instance[legacy_template_id]' => inst.legacy_template_id
+ visit instances_url, :post, 'instance[name]' => inst.name, 'instance[assembly_xml]' => inst[:deployment_xml], 'instance.image_uuid' => inst.image_uuid, 'instance.image_build_uuid' => inst.image_build_uuid
end
Then /^I should see mock instance in JSON format$/ do
diff --git a/src/features/step_definitions/legacy_assembly_steps.rb b/src/features/step_definitions/legacy_assembly_steps.rb
deleted file mode 100644
index b1d0f70..0000000
--- a/src/features/step_definitions/legacy_assembly_steps.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-Given /^there is an assembly named "([^"]*)"$/ do |name|
- LegacyAssembly.create!(:name => name, :architecture => 'x86_64', :owner => user)
-end
-
-Given /^there is an assembly named "([^"]*)" belonging to "([^"]*)"$/ do |assembly_name, deployable_name|
- deployable = LegacyDeployable.find_by_name(deployable_name)
- deployable.legacy_assemblies.create!(:name => assembly_name, :architecture => 'x86_64', :owner => user)
-# Assembly.create!(:name => assembly, :architecture => 'x86_64', :deployable => Deployable.find_by_name(deployable))
-end
-
-Given /^there is an assembly named "([^"]*)" belonging to "([^"]*)" template$/ do |assembly_name, template_name|
- template = LegacyTemplate.find_by_name(template_name)
- assembly = LegacyAssembly.find_by_name(assembly_name)
- unless assembly.nil?
- template.legacy_assemblies << assembly
- else
- template.legacy_assemblies.create!(:name => assembly_name, :architecture => 'x86_64')
- end
-# Assembly.create!(:name => assembly, :architecture => 'x86_64', :legacy_deployable => Deployable.find_by_name(legacy_deployable))
-end
-
-When /^I check the "([^"]*)" assembly$/ do |name|
- assembly = LegacyAssembly.find_by_name(name)
- check("assembly_checkbox_#{assembly.id}")
-end
diff --git a/src/features/step_definitions/legacy_deployable_steps.rb b/src/features/step_definitions/legacy_deployable_steps.rb
deleted file mode 100644
index 0bcb410..0000000
--- a/src/features/step_definitions/legacy_deployable_steps.rb
+++ /dev/null
@@ -1,35 +0,0 @@
-Then /^there should be no deployables$/ do
- LegacyDeployable.count.should == 0
-end
-
-Given /^there are no deployables$/ do
- LegacyDeployable.count.should == 0
-end
-
-Then /^I should have a deployable named "([^"]*)"$/ do |name|
- LegacyDeployable.find_by_name(name).should_not be_nil
-end
-
-Given /^there is a deployable named "([^"]*)"$/ do |name|
- @deployable = LegacyDeployable.create!(:name => name, :owner => user)
-end
-
-When /^I check the "([^"]*)" deployable$/ do |name|
- deployable = LegacyDeployable.find_by_name(name)
- check("deployable_checkbox_#{deployable.id}")
-end
-
-Given /^there are deployment named "([^"]*)" belongs to "([^"]*)"$/ do |deployment_name, deployable_name|
- Factory(:deployment, :legacy_deployable => LegacyDeployable.find_by_name(deployable_name), :name => deployment_name)
-end
-
-Given /^there is a factory deployable named "([^"]*)"$/ do |arg1|
- Factory(:legacy_deployable, :name => arg1)
-end
-
-When /^I select default hardware profile for assemblies in "([^"]*)"$/ do |arg1|
- deployable = LegacyDeployable.find_by_name(arg1)
- deployable.legacy_assemblies.each do |a|
- select('mock_profile', :from => "hw_profiles_#{a.id}")
- end
-end
diff --git a/src/features/step_definitions/legacy_template_steps.rb b/src/features/step_definitions/legacy_template_steps.rb
deleted file mode 100644
index 5a6b154..0000000
--- a/src/features/step_definitions/legacy_template_steps.rb
+++ /dev/null
@@ -1,130 +0,0 @@
-Given /^There is a mock pulp repository$/ do
- dir = File.join(Rails.root, 'spec', 'fixtures')
- hydra = Typhoeus::Hydra.hydra
- hydra.stub(:get, "http://pulptest/repositories/").and_return(
- Typhoeus::Response.new(:code => 200,
- :body => File.read(File.join(dir, 'repositories.json'))))
- hydra.stub(:get, "http://pulptest/repositories/fedora/packagegroups/").and_return(
- Typhoeus::Response.new(:code => 200,
- :body => File.read(File.join(dir, 'packagegroups.json'))))
- hydra.stub(:get, "http://pulptest/repositories/fedora/packages/").and_return(
- Typhoeus::Response.new(:code => 200,
- :body => File.read(File.join(dir, 'packages.json'))))
- hydra.stub(:get, "http://pulptest/repositories/fedora/packagegroupcategories/").and_return(
- Typhoeus::Response.new(:code => 200,
- :body => File.read(File.join(dir, 'packagegroupcategories.json'))))
- hydra.stub(:get, "http://pulptest/repositories/fedora/packages/?name=libdeltacloud").and_return(
- Typhoeus::Response.new(:code => 200,
- :body => File.read(File.join(dir, 'packagesearch_libdeltacloud.json'))))
-end
-
-Given /^there is a "([^"]*)" template$/ do |name|
- @template = Factory.build :legacy_template, :name => name
- @template.save!
-end
-
-Given /^there is a package group$/ do
- RepositoryManager.new.all_groups.should have_at_least(1).item
-end
-
-Given /^no package is selected$/ do
- @template.packages = []
-end
-
-Given /^there is one selected package$/ do
- pkg = RepositoryManager.new.all_packages.first
- @template.packages = [pkg['name']]
- @template.save!
-end
-
-# "I jump" is used instead of "I am" because "I am" is already defined in
-# web_steps.rb and in this case I have to use @template as parameter which "I
-# am" doesn't support
-Given /^I jump on the "([^"]*)" template software page$/ do |name|
- visit url_for(:action => 'software', :controller => 'legacy_templates', :id => @template)
-end
-
-Given /^there are these legacy_templates:$/ do |table|
- table.hashes.each do |hash|
- @template = Factory.build(:legacy_template, :name => hash['name'],
- :platform => hash['platform'])
- @template.save!
- @template.platform_version = hash['platform_version']
- @template.architecture = hash['architecture']
- @template.summary = hash['summary']
- @template.save!
- end
-end
-
-Then /^I should have a template named "([^"]*)"$/ do |name|
- LegacyTemplate.first(:order => 'created_at DESC').xml.name.should eql(name)
-end
-
-Then /^the "([^"]*)" field by name should contain "([^"]*)"$/ do |field, value|
- field_value = field_named(field).value
- if field_value.respond_to? :should
- field_value.should =~ /#{value}/
- else
- assert_match(/#{value}/, field_value)
- end
-end
-
-Then /^the page should contain "([^"]*)" selector$/ do |selector|
- response.should have_selector(selector)
-end
-
-Then /^the page should not contain "([^"]*)" selector$/ do |selector|
- response.should_not have_selector(selector)
-end
-
-Then /^I should see "([^"]*)" followed by "([^"]*)"$/ do |arg1, arg2|
- # webrat doesn't support checking order of elements on a page, so
- # this seems to be siplest check
- (response.body =~ /#{Regexp.escape(arg1)}.*#{Regexp.escape(arg2)}/m).should_not be_nil
-end
-
-Given /^there is a "([^"]*)" build$/ do |arg1|
- @template = Factory.build :legacy_template, :name => arg1
- @template.save!
- image = Factory.build(:legacy_image, :legacy_template => @template)
- image.save!
-end
-
-When /^I choose this template$/ do
- click_link((a)template.name)
-end
-Given /^there is Amazon AWS provider account$/ do
- account = Factory.build(:ec2_provider_account)
- account.save!
-end
-
-Given /^there is Amazon AWS build and push for this template$/ do
- image = Factory.create(:legacy_image, :legacy_template => @template, :status => LegacyImage::STATE_COMPLETED)
- Factory.create(:ec2_provider_image, :legacy_image => image)
-end
-
-Given /^there is Amazon AWS build for this template$/ do
- Factory.create(:legacy_image, :legacy_template => @template, :status => LegacyImage::STATE_COMPLETED)
-end
-
-Given /^there is Amazon AWS provider$/ do
- Factory.create(:ec2_provider)
-end
-
-Given /^there is an imported template$/ do
- @template = Factory.build :legacy_template, :name => name, :imported => true
- @template.save!
-end
-
-Given /^has package "([^"]*)"$/ do |arg1|
- @template.add_packages [arg1]
-end
-
-When /^I edit the template$/ do
- visit edit_legacy_template_url(@template)
-end
-
-When /^(?:|I )check "([^"]*)" template$/ do |template_name|
- template = LegacyTemplate.find_by_name(template_name)
- check("selected_#{template.id}")
-end
diff --git a/src/features/step_definitions/pool_steps.rb b/src/features/step_definitions/pool_steps.rb
index 517d36f..f3aa02c 100644
--- a/src/features/step_definitions/pool_steps.rb
+++ b/src/features/step_definitions/pool_steps.rb
@@ -26,8 +26,9 @@ Given /^a pool "([^"]*)" exists with deployment "([^"]*)"$/ do |pool_name, deplo
pool_family = PoolFamily.find_by_name('default') || Factory(:pool_family)
quota = Factory(:quota)
pool = Pool.find_by_name(pool_name) || Pool.create!(:name => pool_name, :pool_family => pool_family, :quota => quota)
- deployable = LegacyDeployable.create!(:name => 'deployable1', :owner => User.first)
- Deployment.create!(:name => deployment_name, :pool => pool, :legacy_deployable => deployable, :owner => User.first)
+ deployment = Deployment.new(:name => deployment_name, :pool => pool, :owner => User.first)
+ deployment.import_xml_from_url("http://localhost/deployables/deployable1.xml")
+ deployment.save!
end
Then /^I should have a pool named "([^\"]*)"$/ do |name|
diff --git a/src/features/step_definitions/provider_steps.rb b/src/features/step_definitions/provider_steps.rb
index 5f5a637..72d0e43 100644
--- a/src/features/step_definitions/provider_steps.rb
+++ b/src/features/step_definitions/provider_steps.rb
@@ -36,10 +36,6 @@ Given /^there are these providers:$/ do |table|
end
end
-Given /^this provider has (\d+) provider images$/ do |number|
- number.to_i.times { |i| Factory(:legacy_provider_image, :provider => @provider) }
-end
-
Given /^this provider has (\d+) hardware profiles$/ do |number|
number.to_i.times { |i| Factory(:mock_hwp1, :provider => @provider) }
end
@@ -53,10 +49,6 @@ Given /^this provider has a provider account$/ do
Factory(:mock_provider_account, :provider => @provider)
end
-Then /^there should not be any provider images$/ do
- LegacyProviderImage.find(:all, :conditions => { :provider_id => @provider.id} ).size.should == 0
-end
-
Then /^there should not be any hardware profiles$/ do
HardwareProfile.find(:all, :conditions => { :provider_id => @provider.id} ).size.should == 0
end
diff --git a/src/features/suggested_deployables.feature b/src/features/suggested_deployables.feature
index 9f0240a..46e67d9 100644
--- a/src/features/suggested_deployables.feature
+++ b/src/features/suggested_deployables.feature
@@ -6,7 +6,6 @@ Feature: Manage Suggested Deployables
Background:
Given I am an authorised user
And I am logged in
- And There is a mock pulp repository
Scenario: Create new deployable
Given I am on the suggested deployables page
diff --git a/src/spec/factories/deployment.rb b/src/spec/factories/deployment.rb
index 13ec735..9420a16 100644
--- a/src/spec/factories/deployment.rb
+++ b/src/spec/factories/deployment.rb
@@ -1,6 +1,5 @@
Factory.define :deployment do |d|
d.sequence(:name) { |n| "deployment#{n}" }
- d.association :legacy_deployable, :factory => :legacy_deployable
d.association :pool, :factory => :pool
d.association :owner, :factory => :user
d.after_build do |deployment|
diff --git a/src/spec/factories/instance.rb b/src/spec/factories/instance.rb
index 2bc4a5a..8da817c 100644
--- a/src/spec/factories/instance.rb
+++ b/src/spec/factories/instance.rb
@@ -3,10 +3,16 @@ Factory.define :instance do |i|
i.sequence(:external_key) { |n| "key#{n}" }
i.association :hardware_profile, :factory => :mock_hwp1
i.association :provider_account, :factory => :mock_provider_account
- i.association :legacy_template, :factory => :legacy_template
i.association :pool, :factory => :pool
i.association :owner, :factory => :user
i.state "running"
+ i.after_build do |instance|
+ deployment = Factory.build :deployment
+ assembly = deployment.deployable_xml.assemblies[0]
+ instance.image_uuid = assembly.image_id
+ instance.image_build_uuid = assembly.image_build
+ instance.assembly_xml = assembly.to_s
+ end
end
Factory.define :other_owner_instance, :parent => :instance do |i|
--
1.7.4.4
12 years, 12 months
[PATCH conductor] Fixed deployment show view
by Jan Provazník
From: Jan Provaznik <jprovazn(a)redhat.com>
Instances are now listed both in pretty/filter mode.
Added deployment alerts.
---
src/app/controllers/deployments_controller.rb | 3 +--
src/app/views/deployments/_alerts_show.haml | 15 +++++++++++++++
src/app/views/deployments/_deployment.haml | 4 ++--
src/app/views/deployments/_filter_view_show.haml | 19 ++++++++++++++++---
src/app/views/deployments/_instances.haml | 2 --
src/app/views/deployments/_pretty_view_show.haml | 19 ++++++++++++++++---
src/app/views/deployments/show.haml | 1 +
src/app/views/pools/_deployments.haml | 2 +-
8 files changed, 52 insertions(+), 13 deletions(-)
create mode 100644 src/app/views/deployments/_alerts_show.haml
delete mode 100644 src/app/views/deployments/_instances.haml
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index 9052f9c..8f8948d 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -118,9 +118,8 @@ class DeploymentsController < ApplicationController
@deployment = Deployment.find(params[:id])
require_privilege(Privilege::VIEW, @deployment)
init_new_deployment_attrs
- @tab_captions = ['Properties', 'Instances', 'Provider Services', 'Required Services', 'History', 'Permissions','Operation']
- @details_tab = params[:details_tab].blank? ? 'properties' : params[:details_tab]
save_breadcrumb(deployment_path(@deployment, :viewstate => viewstate_id), @deployment.name)
+ @failed_instances = @deployment.instances.select {|instance| instance.state == Instance::STATE_CREATE_FAILED || instance.state == Instance::STATE_ERROR}
@view = filter_view? ? 'filter_view_show' : 'pretty_view_show'
respond_to do |format|
format.js { render :partial => @view }
diff --git a/src/app/views/deployments/_alerts_show.haml b/src/app/views/deployments/_alerts_show.haml
new file mode 100644
index 0000000..766b25d
--- /dev/null
+++ b/src/app/views/deployments/_alerts_show.haml
@@ -0,0 +1,15 @@
+- if @failed_instances.count > 0
+ %section.content-section.alerts
+ %header
+ %h2 Alerts
+ %span.label.badge.alert.count= @failed_instances.length
+ .section-controls
+ %a.collapse{'href'=>'#'} Collapse
+ .content.collapsible.closed
+ %dl.alerts
+ %ul
+ - @failed_instances.each do |inst|
+ %li.alert
+ %dt.subject.critical= inst.name
+ %dd.type Instance Failure
+ %dd.desc= "#{inst.last_error.blank? ? inst.state : inst.last_error}"
diff --git a/src/app/views/deployments/_deployment.haml b/src/app/views/deployments/_deployment.haml
index f07cc00..93e7dbc 100644
--- a/src/app/views/deployments/_deployment.haml
+++ b/src/app/views/deployments/_deployment.haml
@@ -1,6 +1,6 @@
%div.deployment_pretty
%h3
- = deployment.name
+ = link_to(deployment.name, deployment)
%ul
%li
= count_uptime(deployment.created_at)
@@ -8,4 +8,4 @@
= deployment.instances.count
Instances
%p
- = deployment.provider.provider_type.name if deployment.provider
\ No newline at end of file
+ = deployment.provider.provider_type.name if deployment.provider
diff --git a/src/app/views/deployments/_filter_view_show.haml b/src/app/views/deployments/_filter_view_show.haml
index 8146912..dc8934a 100644
--- a/src/app/views/deployments/_filter_view_show.haml
+++ b/src/app/views/deployments/_filter_view_show.haml
@@ -1,3 +1,16 @@
-%h3
- Filter View for
- = @deployment.name
+%header
+ %h2 Instances
+= filter_table([{:name => 'Name'}, {:name => 'Uptime'}, {:name => 'Public Address'}, {:name => 'State'}], @deployment.instances) do |instance|
+ %tr
+ %td
+ %input{:name => "instance_selected[]", :type => "checkbox", :value => instance.id, :id => "instance_checkbox_#{instance.id}" }
+ %td
+ -#there will be icons (belongs to mockups)
+ %td
+ = instance.name
+ %td
+ = count_uptime(instance.created_at)
+ %td
+ = instance.public_addresses
+ %td
+ = instance.state
diff --git a/src/app/views/deployments/_instances.haml b/src/app/views/deployments/_instances.haml
deleted file mode 100644
index 2ac1792..0000000
--- a/src/app/views/deployments/_instances.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-%h3 List Instances for Deployment
-%h3 "Expand" button shifts list view to show the Instance list
diff --git a/src/app/views/deployments/_pretty_view_show.haml b/src/app/views/deployments/_pretty_view_show.haml
index 5ed3ad8..4cb9c13 100644
--- a/src/app/views/deployments/_pretty_view_show.haml
+++ b/src/app/views/deployments/_pretty_view_show.haml
@@ -1,4 +1,17 @@
-%h3
- Pretty View
+%header
+ %h2 Instances
+%ul.instances_list
+ - @deployment.instances.each do |instance|
+ %li
+ = instance.name
+ %ul
+ %li
+ Uptime:
+ = count_uptime(instance.created_at)
+ %li
+ IP Address:
+ = instance.public_addresses
+ %li
+ State:
+ = instance.state
-= render :partial => 'properties'
diff --git a/src/app/views/deployments/show.haml b/src/app/views/deployments/show.haml
index e7e9276..09e7a25 100644
--- a/src/app/views/deployments/show.haml
+++ b/src/app/views/deployments/show.haml
@@ -1,3 +1,4 @@
= render :partial => 'header_show'
+= render :partial => 'alerts_show'
%section.content-section.toggle-view
= render :partial => @view
diff --git a/src/app/views/pools/_deployments.haml b/src/app/views/pools/_deployments.haml
index 6aa3d07..df14c64 100644
--- a/src/app/views/pools/_deployments.haml
+++ b/src/app/views/pools/_deployments.haml
@@ -3,4 +3,4 @@
%li
=deployment.name
=count_uptime(deployment.created_at)
- =deployment.instances.count if deployment.instances
\ No newline at end of file
+ =deployment.instances.count if deployment.instances
--
1.7.4
12 years, 12 months
[PATCH] Install on Fedora 15 systems and allow customization
by Steven Dake
Fedora 15 systems use a version of cronie that is tailored towards systemd.
As a result, the default RedHat.py cron handling doesn't work on Fedora 15.
This patch has been tested with cron disabled to start (where it was returned
to disabled) and cron enabled to start (where it remained enabled) on both
F15 and RHEL6.1.
Signed-off-by: Steven Dake <sdake(a)redhat.com>
---
oz/RedHat.py | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/oz/RedHat.py b/oz/RedHat.py
index dc454a7..523efba 100644
--- a/oz/RedHat.py
+++ b/oz/RedHat.py
@@ -28,6 +28,7 @@ class RedHatCDGuest(oz.Guest.CDGuest):
oz.Guest.CDGuest.__init__(self, tdl, nicmodel, clockoffset, mousetype,
diskbus, config)
self.sshprivkey = os.path.join('/etc', 'oz', 'id_rsa-icicle-gen')
+ self.crond_was_active = False
self.sshd_config = \
"""SyslogFacility AUTHPRIV
PasswordAuthentication yes
@@ -135,11 +136,15 @@ Subsystem sftp /usr/libexec/openssh/sftp-server
# reset the service link
self.log.debug("Resetting crond service")
- startuplink = self.get_service_runlevel_link(g_handle, 'crond')
- if g_handle.exists(startuplink):
- g_handle.rm(startuplink)
- if g_handle.exists(startuplink + ".icicle"):
- g_handle.mv(startuplink + ".icicle", startuplink)
+ if g_handle.exists('/lib/systemd/system/crond.service'):
+ if not self.crond_was_active:
+ g_handle.rm('/etc/systemd/system/multi-user.target.wants/crond.service')
+ else:
+ startuplink = self.get_service_runlevel_link(g_handle, 'crond')
+ if g_handle.exists(startuplink):
+ g_handle.rm(startuplink)
+ if g_handle.exists(startuplink + ".icicle"):
+ g_handle.mv(startuplink + ".icicle", startuplink)
def image_ssh_teardown_step_5(self, g_handle):
self.log.debug("Teardown step 5")
@@ -214,7 +219,7 @@ Subsystem sftp /usr/libexec/openssh/sftp-server
def image_ssh_setup_step_4(self, g_handle):
# part 4; make sure the guest announces itself
self.log.debug("Step 4: Guest announcement")
- if not g_handle.exists('/etc/init.d/crond') or not g_handle.exists('/usr/sbin/crond'):
+ if not g_handle.exists('/usr/sbin/crond'):
raise oz.OzException.OzException("cron not installed on the image, cannot continue")
iciclepath = oz.ozutil.generate_full_guesttools_path('icicle-nc')
@@ -228,10 +233,16 @@ Subsystem sftp /usr/libexec/openssh/sftp-server
g_handle.upload(announcefile, '/etc/cron.d/announce')
- startuplink = self.get_service_runlevel_link(g_handle, 'crond')
- if g_handle.exists(startuplink):
- g_handle.mv(startuplink, startuplink + ".icicle")
- g_handle.ln_sf('/etc/init.d/crond', startuplink)
+ if g_handle.exists('/lib/systemd/system/crond.service'):
+ if g_handle.exists('/etc/systemd/system/multi-user.target.wants/crond.service'):
+ self.crond_was_active = True;
+ else:
+ g_handle.ln_sf('/lib/systemd/system/crond.service', '/etc/systemd/system/multi-user.target.wants/crond.service')
+ else:
+ startuplink = self.get_service_runlevel_link(g_handle, 'crond')
+ if g_handle.exists(startuplink):
+ g_handle.mv(startuplink, startuplink + ".icicle")
+ g_handle.ln_sf('/etc/init.d/crond', startuplink)
os.unlink(announcefile)
--
1.7.4.4
12 years, 12 months