[PATCH aeolus-cli 0/2] Refactor option parser to resolve BZ #754956
by Petr Blaho
The bug showed that options definitions for OptionParser was duplicated.
There were some options defined more than once and only last definition takes action
so some parameters did not work.
OptionParser did not distinguish between commands (list, push, delete, etc.) used in aeolus-cli
Me and mzatko refactored code for parsing cli options and extended test coverage of this code.
12 years, 4 months
[PATCH conductor] Fixing message for user creation
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
https://bugzilla.redhat.com/show_bug.cgi?id=751364
---
src/config/locales/en.yml | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
index f69c3b1..33453f2 100644
--- a/src/config/locales/en.yml
+++ b/src/config/locales/en.yml
@@ -30,7 +30,7 @@ en:
user_status: User Status
new:
new_user: New User
- neccessary_information: "Enter necessary information about your new user and click 'Create User' when you are finished."
+ neccessary_information: "Enter necessary information about your new user and click 'Save User' when you are finished."
list:
delete_selected: Delete Selected
unlimited: Unlimited
--
1.7.6.4
12 years, 4 months
[PATCH conductor] Adding required fields indicator for user form
by Imre Farkas
From: Imre Farkas <ifarkas(a)redhat.com>
---
src/app/helpers/application_helper.rb | 18 ++++++++++++++++++
src/app/views/users/_form.html.haml | 8 ++++----
src/app/views/users/edit.html.haml | 2 +-
src/app/views/users/new.html.haml | 2 +-
4 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/app/helpers/application_helper.rb b/src/app/helpers/application_helper.rb
index cbb7a43..2c6aa05 100644
--- a/src/app/helpers/application_helper.rb
+++ b/src/app/helpers/application_helper.rb
@@ -161,4 +161,22 @@ module ApplicationHelper
end
module_function :count_uptime
+
+ class FormBuilderWithRequiredFields < ActionView::Helpers::FormBuilder
+
+ def label(method, text = nil, options = {}, &block)
+ text << ' *' if required?(object, method, options)
+ super(method, text, options, &block)
+ end
+
+ private
+
+ def required?(object, attribute, options)
+ return options[:required] if options.has_key?(:required)
+ object.class.validators_on(attribute).map(&:class).include? ActiveModel::Validations::PresenceValidator
+ end
+
+ end
+
end
+
diff --git a/src/app/views/users/_form.html.haml b/src/app/views/users/_form.html.haml
index 665a35c..e3b8945 100644
--- a/src/app/views/users/_form.html.haml
+++ b/src/app/views/users/_form.html.haml
@@ -9,17 +9,17 @@
= form.label :last_name, t(:last_name)
= form.text_field :last_name, :class =>"check_change"
%p
- = form.label :email, t(:email)
+ = form.label :email, t(:email), :required => true
= form.text_field :email, :class =>"check_change"
%fieldset
%p
- = form.label :login, t(:choose_name)
+ = form.label :login, t(:choose_name), :required => true
= form.text_field :login, :class => "em check_change"
%p
- = form.label :password, form.object.new_record? ? t(:choose_password) : t(:change_password)
+ = form.label :password, form.object.new_record? ? t(:choose_password) : t(:change_password), :required => form.object.new_record?
= form.password_field :password
%p
- = form.label :password_confirmation, t(:confirm_password)
+ = form.label :password_confirmation, t(:confirm_password), :required => form.object.new_record?
= form.password_field :password_confirmation
-if check_privilege(Privilege::MODIFY, User)
diff --git a/src/app/views/users/edit.html.haml b/src/app/views/users/edit.html.haml
index 70bf0c4..81e42db 100644
--- a/src/app/views/users/edit.html.haml
+++ b/src/app/views/users/edit.html.haml
@@ -21,5 +21,5 @@
%dd#email= @user.email
%dt=t'users.show.username'
%dd#login= @user.login
- = form_for @user, :url => user_path(@user), :html => { :method => :put, :class => 'generic' } do |f|
+ = form_for @user, :url => user_path(@user), :builder => ApplicationHelper::FormBuilderWithRequiredFields, :html => { :method => :put, :class => 'generic' } do |f|
= render :partial => "form", :locals => { :form => f, :cancel_path => users_path }
diff --git a/src/app/views/users/new.html.haml b/src/app/views/users/new.html.haml
index e6e914d..b612564 100644
--- a/src/app/views/users/new.html.haml
+++ b/src/app/views/users/new.html.haml
@@ -23,7 +23,7 @@
%dd#email
%dt=t'users.show.username'
%dd#login
- = form_for @user, :url => users_path, :html => {:class => 'generic'} do |f|
+ = form_for @user, :url => users_path, :builder => ApplicationHelper::FormBuilderWithRequiredFields, :html => {:class => 'generic'} do |f|
-if current_user
= render :partial => "form", :locals => { :form => f }
-else
--
1.7.6.4
12 years, 4 months
Possible bug, or missing documentation (not sure =).
by Kurt Seifried
Ok so I got RHEVM setup and working, and setup a new Aeolus 0.6.0 on
RHEL 6 attached to it (seems to have worked, when I added the
accounts/etc. I didn't get an error so that's good). But when I try to
build an image it fails, I investigated and I think I may have found
part of the problem but am not sure, thought I'd run it by you guys for
comment before I spend a ton of time on it:
-------------------------------------------------------------------------
[root@aeolus-060 ~]# aeolus-cli build --target rhevm --template template.xml
Image: 633bb742-c37e-402e-9659-9dd793c68686
Build: fa23f04a-8c28-4101-8ed0-dccd360194e0
Target Image: ba9aa6a2-fc4b-42a1-8fb0-d66d6e7f936f :Status BUILDING
-------------------------------------------------------------------------
2011-11-29 17:49:38,993 DEBUG
imgfac.builders.BaseBuilder.Fedora_rhevm_Builder pid(4161) Message:
Found neither a call-time config nor a config file - doing nothing
2011-11-29 17:49:39,073 DEBUG paste.httpserver.ThreadPool pid(4161)
Message: Added task (0 tasks queued)
2011-11-29 17:49:39,426 DEBUG oz.Guest.FedoraGuest pid(4161) Message:
libvirt bridge name is virbr0
2011-11-29 17:49:39,432 DEBUG
imgfac.builders.BaseBuilder.Fedora_rhevm_Builder pid(4161) Message:
Exception caught in ImageFactory
2011-11-29 17:49:39,436 DEBUG
imgfac.builders.BaseBuilder.Fedora_rhevm_Builder pid(4161) Message:
Traceback (most recent call last):
File
"/usr/lib/python2.6/site-packages/imgfac/builders/Fedora_rhevm_Builder.py",
line 65, in build_image
self.build_upload(build_id)
File
"/usr/lib/python2.6/site-packages/imgfac/builders/Fedora_rhevm_Builder.py",
line 92, in build_upload
guest = oz.GuestFactory.guest_factory(self.tdlobj, oz_config, None)
File "/usr/lib/python2.6/site-packages/oz/GuestFactory.py", line 52,
in guest_factory
klass = oz.Fedora.get_class(tdl, config, auto, output_disk)
File "/usr/lib/python2.6/site-packages/oz/Fedora.py", line 98, in
get_class
output_disk)
File "/usr/lib/python2.6/site-packages/oz/Fedora.py", line 43, in __init__
True, True, directkernel)
File "/usr/lib/python2.6/site-packages/oz/RedHat.py", line 42, in __init__
None, None, diskbus, iso_allowed, url_allowed)
File "/usr/lib/python2.6/site-packages/oz/Guest.py", line 1152, in
__init__
mousetype, diskbus, iso_allowed, url_allowed)
File "/usr/lib/python2.6/site-packages/oz/Guest.py", line 179, in __init__
self.connect_to_libvirt()
File "/usr/lib/python2.6/site-packages/oz/Guest.py", line 122, in
connect_to_libvirt
self._discover_libvirt_type()
File "/usr/lib/python2.6/site-packages/oz/Guest.py", line 74, in
_discover_libvirt_type
raise oz.OzException.OzException("This host does not support
virtualization type kvm or qemu")
OzException: This host does not support virtualization type kvm or qemu
2011-11-29 17:49:39,440 DEBUG imgfac.BuildJob.BuildJob pid(4161)
Message: Builder (952fac2d-df7d-42cd-b2bc-3c9d6affd716) changed status
from BUILDING to FAILED
-------------------------------------------------------------------------
So looking through "aeolus-cli -h" I'm not seeing anything for
kvm/qemu/config type of options. Now reading the code we got things like:
@config_location = "~/.aeolus-cli"
is this
/usr/lib/ruby/gems/1.8/gems/aeolus-cli-0.1.0/examples/aeolus-cli
a correct example? If so what should I add, something like
:conductor:
:virtualization: kvm
or?
--
-Kurt Seifried / Red Hat Security Response Team
12 years, 4 months