[PATCH configure] BZ799814: added basic validations for aeolus-configure
by Maros Zatko
From: Maros Zatko <mzatko(a)redhat.com>
---
bin/aeolus-configure | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/bin/aeolus-configure b/bin/aeolus-configure
index a12b4fb..b32d5e0 100755
--- a/bin/aeolus-configure
+++ b/bin/aeolus-configure
@@ -27,11 +27,12 @@ OPTIONS:
-v | --verbose Verbose logging mode.
Note that you can only set one of the previous two options per run. If both are set,
the last one passed in will be honored.
- -p | --profile Name of profile to use. A comma separated list can be used to specify multiple profiles.
+ -p | --profile Name of profile to use. A comma separated list can be used to specify multiple profiles.
+ -s | --skip-missing Skip missing profiles provided by -p option.
EOF
}
-args=`getopt -o :hdvip: --long help,debug,verbose,interactive,profile: -- "$@"`
+args=`getopt -o hdvip:s --long help,debug,verbose,interactive,profile:,skip-missing -- "$@"`
if test $? != 0
then
usage
@@ -41,6 +42,7 @@ fi
INTERACTIVE=1
PUPPET_NODE='default'
+SKIP_MISSING_NODE=0
eval set -- $args
while true ; do
@@ -49,11 +51,17 @@ while true ; do
-d|--debug) LOGLEVEL="--debug" ; shift ;;
-v|--verbose) LOGLEVEL="--verbose" ; shift ;;
-p|--profile) PUPPET_NODE=$2 ; shift ; shift ;;
+ -s|--skip-missing) SKIP_MISSING_NODE=1 ; shift ;;
--) shift ; break ;;
*) usage ; exit 1 ;;
esac
done
-
+echo $args | grep -e '--\ .*' -q
+if [ $? == 0 ]; then
+ echo "Invalid options supplied."
+ usage
+ exit 1
+fi
echo "Launching aeolus configuration recipe..."
export FACTER_AEOLUS_ENABLE_HTTPS=true
@@ -65,9 +73,21 @@ HAS_FAILURES=0
NODE_ARRAY=(`echo $PUPPET_NODE | tr "," "\n"`)
for x in "${NODE_ARRAY[@]}"
do
- /usr/share/aeolus-configure/modules/aeolus/aeolus-node-check /etc/aeolus-configure/nodes/${x}_configure
+ if [ -e /etc/aeolus-configure/nodes/${x}_configure ]; then
+ /usr/share/aeolus-configure/modules/aeolus/aeolus-node-check /etc/aeolus-configure/nodes/${x}_configure
+ else
+ echo Error: ${x} configure node is missing
+ echo \"/etc/aeolus-configure/nodes/${x}_configure\" does not exist
+ if [ $SKIP_MISSING_NODE == 1 ]; then
+ echo ignoring
+ continue
+ else
+ echo exitting
+ exit
+ fi
+ fi
if [ $? != 0 ]; then
- exit 1
+ exit 1
fi
puppet /usr/share/aeolus-configure/modules/aeolus/aeolus.pp \
--modulepath=/usr/share/aeolus-configure/modules/ \
@@ -77,7 +97,7 @@ do
$LOGLEVEL \
--detailed-exitcodes
if [ $? != 0 -a $? != 2 ] ; then
- HAS_FAILURES=1
+ HAS_FAILURES=1
fi
done
--
1.7.7.6
10 years, 11 months
Aeolus GSoC
by Mo Morsi
Hey all, I want to congratulate and introduce everyone to Samridh whose
proposal [1] was selected to work on Aeolus as part of the Google Summer
of Code.
I also want to introduce Nitesh and Furhan, who'se Aeolus proposals [2]
[3] were also very strong but unfortunately were not selected due to the
limited number of slots we had available in the GSoC. Nitesh graciously
volunteered to still dedicate some time to help us out with the project
over the summer which is more than appreciated. I would like to thank
them both for their hard work on their proposals up to this point (all
three have been in regular contact to learn and setup the Aeolus
framework and determine what the project needs going forward).
Matt and I are starting to work with them to implement their strategies
to contribute to the project. Samridh is going to start by looking at
expanding aeolus-cli, currently we have image support and Martyn / Petr
are now adding support for providers and provider accounts. As part of
the GSoC project we will continue expanding this to support hardware
profiles, instances, and other conductor entities.
Nitesh is going to be working towards implementing a QT based
desktop-interface to the conductor API. He will begin by setting up a
new project on github w/ the basic QT application layout and expanding
it from there to support Conductor capabilities. He will also be looking
at expanding the conductor API to add new features as needed.
Overall I'd like to welcome them to the project and am looking forward
to helping drive there proposals and projects forward and continuing to
expand the community, especially at the student / collegiate level. You
may notice some traffic from them via email and irc in the upcoming
weeks / month, and I ask that when possible the existing developers help
them out with any questions they may have in getting familiar w/ our
design, implementation, and contributor workflow.
Should be a great Summer of Aeolus! :-)
-Mo
[1]
https://fedoraproject.org/wiki/GSOC_2012/Student_Application_Samridh90/Br...
[2]
https://fedoraproject.org/wiki/GSOC_2012/Student_Application_niteshnaraya...
[3]
https://fedoraproject.org/wiki/GSOC_2012/Student_Application_furhanshabir
10 years, 11 months
[PATCH conductor/gelato] Converge ui repo as git submodule... rev2
by Jirka Tomasek
This patchset adds converge-ui as git submodule into vendor/converge-ui.
Beware Git cant delete the submodule folder when switching to branch
without that submodule. so the submodule folder remains there as untracked.
Git am has some problem with applying the 0003 patch, so please use git
am for the first 2, then git apply 0003 and commit it and then git am
the 0004.
It is necessary to run 'git submodule init' and 'git submodule update'
after applying the patches. Otherwise the submodule won't be present and
rails will complain about missing files as the simlinks won't work.
Patchset also prepares gelato branch to step by step incorporating the
converge-ui layout, stylesheets and javascripts with conductor.
I am also working on more cleanups of stylesheets in master branch,
which aim to remove unused stylesheets and introduce stylesheets
structure similar to converge-ui (fonts, mixins, reset, header,
layout...) to make the transfer even easier. Partial cleanup will follow.
Jirka
10 years, 11 months
[PATCH conductor] BZ#786207 - need selection validation on launch_new -- adition
by Tomas Hrcka
This patch fixies latest comments on the BZ.
Small js adjustment and changed controller method to one liner
---
src/app/controllers/deployments_controller.rb | 3 +--
src/app/views/deployments/_launch_new.html.haml | 1 +
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index 504a050..d95f19a 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -340,8 +340,7 @@ class DeploymentsController < ApplicationController
# TODO - The AJAX calls here have a potential race condition; might want to include params[:name]
# in the output to help catch this and discard output if appropriate
def check_name
- deployment = Deployment.find_by_name(params[:name])
- render :text => deployment.nil?.to_s
+ render :text => params[:name].empty? ? false : Deployment.find_by_name(params[:name]).nil?
end
def launch_from_catalog
diff --git a/src/app/views/deployments/_launch_new.html.haml b/src/app/views/deployments/_launch_new.html.haml
index 46f1499..30ae4dc 100644
--- a/src/app/views/deployments/_launch_new.html.haml
+++ b/src/app/views/deployments/_launch_new.html.haml
@@ -63,6 +63,7 @@
$('#name_avail_indicator').html(data == "false" ? "#{t'deployments.launch_new.already_in_use'}" : "#{t'deployments.launch_new.name_available'}");
if(data == "true" && $('#next_button').is(':disabled')){
$('#next_button').removeAttr('disabled');
+ }else if(data == "true" && $('#next_button').is_not(':disabled')){
}else{
$('#next_button').attr("disabled", "disabled");
}
--
1.7.1
10 years, 11 months
updating conductor / cli in Fedora 17 (and rawhide)
by Mo Morsi
A few things need tbd to push a working Aeolus build into F17. Note,
this is just for conductor / cli / configure, the releases of other
Aeolus components should now being managed on their respective
communities [1]
- finish up review of and push the Aeolus / Ruby 1.9 patchset (martyn
and I are currently working on this)
- rubygem-shadow needs to make it in, and puppet updated to depend on
it (currently depends on ruby-shadow which doesn't build against 1.9),
currently in progress [2]
- spec files need to be updated to pull in the latest Aeolus release
(0.9.0?)
- rpms rebuilt (locally and in koji), pushed to fedora git, and the
updates submitted via bodhi
Unless I missed something, assuming that everything is sound with all of
this after the rpms make their way through the bodhi karma / vetting
process, the latest Aeolus release should be in Fedora 17 / rawhide!
-Mo
[1] https://www.aeolusproject.org/redmine/projects/aeolus/wiki/Packaging
[2] https://bugzilla.redhat.com/show_bug.cgi?id=782560
10 years, 11 months
[PATCH conductor] BZ805909: Detect if paginated collection is out of bounds (rev. 3)
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=805909
Resending it because a part of the previous revision has already been committed.
---
src/app/controllers/application_controller.rb | 8 +++++
src/app/controllers/deployments_controller.rb | 22 +++++++-------
src/app/controllers/images_controller.rb | 2 +-
src/app/controllers/instances_controller.rb | 15 +++++----
src/app/controllers/pools_controller.rb | 41 ++++++++++++++----------
src/app/models/pool.rb | 6 ----
src/app/views/pools/_pretty_list.html.haml | 2 +-
7 files changed, 53 insertions(+), 43 deletions(-)
diff --git a/src/app/controllers/application_controller.rb b/src/app/controllers/application_controller.rb
index db471ba..9b89d0e 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -36,6 +36,7 @@ class ApplicationController < ActionController::Base
rescue_from Aeolus::Conductor::API::Error, :with => :handle_api_error
helper_method :check_privilege
+ helper_method :paginate_collection
protected
@@ -369,4 +370,11 @@ class ApplicationController < ActionController::Base
redirect_to path.merge(original_params).merge(extended_params)
end
+ def paginate_collection(collection, page = nil, per_page = PER_PAGE)
+ result = collection.paginate(:page => page, :per_page => per_page)
+ result = collection.paginate(:page => result.total_pages, :per_page => per_page) if result.out_of_bounds? && result.total_pages > 0
+
+ result
+ end
+
end
diff --git a/src/app/controllers/deployments_controller.rb b/src/app/controllers/deployments_controller.rb
index 504a050..8bb76b3 100644
--- a/src/app/controllers/deployments_controller.rb
+++ b/src/app/controllers/deployments_controller.rb
@@ -187,13 +187,13 @@ class DeploymentsController < ApplicationController
if filter_view?
@view = 'instances/list'
params[:instances_preset_filter] = "" unless params[:instances_preset_filter]
- @instances = Instance.apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
- list(sort_column(Instance), sort_direction).where("instances.deployment_id" => @deployment.id).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @instances = paginate_collection(Instance.apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
+ list(sort_column(Instance), sort_direction).where("instances.deployment_id" => @deployment.id),
+ params[:page], PER_PAGE)
else
@view = 'pretty_view_show'
- @instances = Instance.list(sort_column(Instance), sort_direction).where("instances.deployment_id" => @deployment.id).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @instances = paginate_collection(Instance.list(sort_column(Instance), sort_direction).where("instances.deployment_id" => @deployment.id),
+ params[:page], PER_PAGE)
end
#TODO add links to real data for history, permissions, services
@tabs = [{:name => t('instances.instances.other'), :view => @view, :id => 'instances', :count => @deployment.instances.count, :pretty_view_toggle => 'enabled'},
@@ -383,12 +383,12 @@ class DeploymentsController < ApplicationController
{ :name => t("providers.provider"), :sortable => false }
]
@pools = Pool.list_for_user(current_user, Privilege::CREATE, Deployment)
- @deployments = Deployment.includes(:owner, :pool, :instances).
- apply_filters(:preset_filter_id => params[:deployments_preset_filter], :search_filter => params[:deployments_search]).
- list_for_user(current_user, Privilege::VIEW).
- where('deployments.pool_id' => @pools).
- order(sort_column(Deployment, "deployments.name") +' '+ sort_direction).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @deployments = paginate_collection(Deployment.includes(:owner, :pool, :instances).
+ apply_filters(:preset_filter_id => params[:deployments_preset_filter], :search_filter => params[:deployments_search]).
+ list_for_user(current_user, Privilege::VIEW).
+ where('deployments.pool_id' => @pools).
+ order(sort_column(Deployment, "deployments.name") +' '+ sort_direction),
+ params[:page], PER_PAGE)
end
def count_additional_quota(deployment)
diff --git a/src/app/controllers/images_controller.rb b/src/app/controllers/images_controller.rb
index cad12f9..d71c1b1 100644
--- a/src/app/controllers/images_controller.rb
+++ b/src/app/controllers/images_controller.rb
@@ -27,7 +27,7 @@ class ImagesController < ApplicationController
{ :name => t('images.index.architecture'), :sort_attr => :name },
{ :name => t('images.index.last_rebuild'), :sortable => false },
]
- @images = Aeolus::Image::Warehouse::Image.all.paginate(:page => params[:page], :per_page => PER_PAGE)
+ @images = paginate_collection(Aeolus::Image::Warehouse::Image.all, params[:page], PER_PAGE)
respond_to do |format|
format.html
format.js { render :partial => 'list' }
diff --git a/src/app/controllers/instances_controller.rb b/src/app/controllers/instances_controller.rb
index 7773d81..1153e96 100644
--- a/src/app/controllers/instances_controller.rb
+++ b/src/app/controllers/instances_controller.rb
@@ -248,14 +248,15 @@ class InstancesController < ApplicationController
def load_instances
if params[:deployment_id].blank?
- @instances = Instance.includes(:owner).apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
- list_for_user(current_user, Privilege::VIEW).list(sort_column(Instance), sort_direction).
- where("instances.pool_id" => @pools).paginate(:page => params[:page], :per_page => PER_PAGE)
+ @instances = paginate_collection(Instance.includes(:owner).apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
+ list_for_user(current_user, Privilege::VIEW).list(sort_column(Instance), sort_direction).
+ where("instances.pool_id" => @pools),
+ params[:page], PER_PAGE)
else
- @instances = Instance.includes(:owner).apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
- list(sort_column(Instance), sort_direction).list_for_user(current_user, Privilege::VIEW).
- where("instances.pool_id" => @pools, "instances.deployment_id" => params[:deployment_id]).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @instances = paginate_collection(Instance.includes(:owner).apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
+ list(sort_column(Instance), sort_direction).list_for_user(current_user, Privilege::VIEW).
+ where("instances.pool_id" => @pools, "instances.deployment_id" => params[:deployment_id]),
+ params[:page], PER_PAGE)
end
end
diff --git a/src/app/controllers/pools_controller.rb b/src/app/controllers/pools_controller.rb
index abc3203..347c180 100644
--- a/src/app/controllers/pools_controller.rb
+++ b/src/app/controllers/pools_controller.rb
@@ -44,25 +44,30 @@ class PoolsController < ApplicationController
@details_tab = @tabs.find {|t| t[:id] == details_tab_name} || @tabs.first[:name].downcase
@user_pools = Pool.list_for_user(current_user, Privilege::CREATE, Deployment)
+
if filter_view?
case @details_tab[:id]
when 'pools'
- @pools = Pool.includes(:deployments, :instances).apply_filters(:preset_filter_id => params[:pools_preset_filter], :search_filter => params[:pools_search]).
- list_for_user(current_user, Privilege::VIEW).list(sort_column(Pool), sort_direction).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @pools = paginate_collection(Pool.includes(:deployments, :instances).
+ apply_filters(:preset_filter_id => params[:pools_preset_filter], :search_filter => params[:pools_search]).
+ list_for_user(current_user, Privilege::VIEW).list(sort_column(Pool), sort_direction),
+ params[:page], PER_PAGE)
when 'instances'
params[:instances_preset_filter] = "" unless params[:instances_preset_filter]
- @instances = Instance.includes({:provider_account => :provider}).apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
- list_for_user(current_user, Privilege::VIEW).list(sort_column(Instance), sort_direction).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @instances = paginate_collection(Instance.includes({:provider_account => :provider}).
+ apply_filters(:preset_filter_id => params[:instances_preset_filter], :search_filter => params[:instances_search]).
+ list_for_user(current_user, Privilege::VIEW).list(sort_column(Instance), sort_direction),
+ params[:page], PER_PAGE)
when 'deployments'
- @deployments = Deployment.includes(:pool, :instances).apply_filters(:preset_filter_id => params[:deployments_preset_filter], :search_filter => params[:deployments_search]).
- list_for_user(current_user, Privilege::VIEW).list(sort_column(Deployment), sort_direction).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @deployments = paginate_collection(Deployment.includes(:pool, :instances).
+ apply_filters(:preset_filter_id => params[:deployments_preset_filter], :search_filter => params[:deployments_search]).
+ list_for_user(current_user, Privilege::VIEW).list(sort_column(Deployment), sort_direction),
+ params[:page], PER_PAGE)
end
else
- @pools = Pool.includes(:deployments, :instances, :quota, :catalogs).list_for_user(current_user, Privilege::VIEW).list(sort_column(Pool), sort_direction).
- paginate(:page => params[:page], :per_page => PER_PAGE)
+ @pools = paginate_collection(Pool.includes(:deployments, :instances, :quota, :catalogs).
+ list_for_user(current_user, Privilege::VIEW).list(sort_column(Pool), sort_direction),
+ params[:page], PER_PAGE)
end
statistics
@@ -109,16 +114,18 @@ class PoolsController < ApplicationController
details_tab_name = params[:details_tab].blank? ? 'deployments' : params[:details_tab]
@details_tab = @tabs.find {|t| t[:id] == details_tab_name} || @tabs.first[:name].downcase
- @deployments = @pool.deployments.includes(:owner, :pool, :instances, :events).
- apply_filters(:preset_filter_id => params[:deployments_preset_filter], :search_filter => params[:deployments_search]).
- list_for_user(current_user, Privilege::VIEW).
- paginate(:page => params[:page], :per_page => PER_PAGE) if @details_tab[:id] == 'deployments'
+ @deployments = paginate_collection(@pool.deployments.includes(:owner, :pool, :instances, :events).
+ apply_filters(:preset_filter_id => params[:deployments_preset_filter], :search_filter => params[:deployments_search]).
+ list_for_user(current_user, Privilege::VIEW),
+ params[:page], PER_PAGE) if @details_tab[:id] == 'deployments'
@view = @details_tab[:view]
respond_to do |format|
format.html { render :action => :show}
format.js { render :partial => @view }
- format.json { render :json => @pool.as_json(:with_deployments => true, :current_user => current_user,
- :page => params[:page], :per_page => PER_PAGE) }
+ format.json do
+ deployments = paginate_collection((a)pool.deployments.list_for_user(current_user, Privilege::VIEW), params[:page], PER_PAGE).map {|d| d.as_json}
+ render :json => @pool.as_json.merge({:deployments => deployments})
+ end
end
end
diff --git a/src/app/models/pool.rb b/src/app/models/pool.rb
index 9556dee..4604bd2 100644
--- a/src/app/models/pool.rb
+++ b/src/app/models/pool.rb
@@ -137,12 +137,6 @@ class Pool < ActiveRecord::Base
})
- if options[:with_deployments]
- result[:deployments] = deployments.list_for_user(options[:current_user], Privilege::VIEW).
- paginate(:page => options[:page], :per_page => options[:per_page]).
- map {|d| d.as_json}
- end
-
result
end
diff --git a/src/app/views/pools/_pretty_list.html.haml b/src/app/views/pools/_pretty_list.html.haml
index 47e7a8b..9b869b1 100644
--- a/src/app/views/pools/_pretty_list.html.haml
+++ b/src/app/views/pools/_pretty_list.html.haml
@@ -25,7 +25,7 @@
%a.control{:href => '#'}
%span Expand/Collapse
%div.content
- - deployments = pool.deployments.includes(:owner, :pool, :instances, :events).list_for_user(current_user, Privilege::VIEW).ascending_by_name.paginate(:page => params[:page], :per_page => PER_PAGE)
+ - deployments = paginate_collection(pool.deployments.includes(:owner, :pool, :instances, :events).list_for_user(current_user, Privilege::VIEW).ascending_by_name, params[:page], PER_PAGE)
= render :partial => 'deployments', :locals => {:pool => pool, :deployments => deployments}
%ul.content.actions
%li
--
1.7.6.5
10 years, 11 months