openSUSE Commits
Threads by month
- ----- 2024 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
May 2011
- 1 participants
- 1385 discussions
Hello community,
here is the log from the commit of package webyast-licenses-ui for openSUSE:Factory
checked in at Wed May 4 11:13:26 CEST 2011.
--------
--- webyast-licenses-ui/webyast-licenses-ui.changes 2010-08-30 11:41:53.000000000 +0200
+++ /mounts/work_src_done/STABLE/webyast-licenses-ui/webyast-licenses-ui.changes 2011-05-02 16:38:34.000000000 +0200
@@ -1,0 +2,12 @@
+Mon May 2 14:35:55 UTC 2011 - vlewin(a)novell.com
+
+- uniform appearance for all modules in basesystem setup workflow
+- 0.2.4
+
+-------------------------------------------------------------------
+Tue Apr 12 14:15:04 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.3
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-licenses-ui.spec ++++++
--- /var/tmp/diff_new_pack.Mm4L6N/_old 2011-05-04 11:11:09.000000000 +0200
+++ /var/tmp/diff_new_pack.Mm4L6N/_new 2011-05-04 11:11:09.000000000 +0200
@@ -26,7 +26,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.2
+Version: 0.2.4
Release: 1
Summary: WebYaST - license management UI
Source: www.tar.bz2
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/eulas_controller.rb new/www/app/controllers/eulas_controller.rb
--- old/www/app/controllers/eulas_controller.rb 2010-05-28 09:52:16.000000000 +0200
+++ new/www/app/controllers/eulas_controller.rb 2011-04-11 16:48:55.000000000 +0200
@@ -42,7 +42,7 @@
end
def ensure_id
- redirect_to :action => :show, :id => 1 and return if params[:id].nil?
+ redirect_to :action => :show, :id => 1 and return if params[:id].nil? # RORSCAN_ITL
@eula_id = [1,params[:id].to_i].max
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/views/eulas/show.html.erb new/www/app/views/eulas/show.html.erb
--- old/www/app/views/eulas/show.html.erb 2010-08-17 13:53:02.000000000 +0200
+++ new/www/app/views/eulas/show.html.erb 2011-04-28 14:21:06.000000000 +0200
@@ -1,61 +1,82 @@
<!--
# Copyright (c) 2009-2010 Novell, Inc.
-#
+#
# All Rights Reserved.
-#
+#
# This program is free software; you can redistribute it and/or modify it
# under the terms of version 2 of the GNU General Public License
# as published by the Free Software Foundation.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
-#
+#
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
-->
<% disabled = ! @permissions[:accept] %>
-<div class='plugin-icon'><img src='/icons/yast-product-registration.png' alt="eula module"/>
+<!--<div class='plugin-icon'><img src='/icons/yast-product-registration.png' alt="eula module"/>
<%=_("Licence Agreement")-%> - <%= @eula.name -%>
-</div>
+</div> -->
+
+<div id="eula" class="plugin-content plugin-border">
+
+<% form_for(:eula, :url => { :action => :update, :id => @eula_id }, :html=> { :method => :put, :class=>"webyast_form"}) do |f| -%>
+
+ <div class="plugin-header">
+ <div class="left">
+ <label class="plugin-icon-container"><img class="plugin-icon" src="/icons/registration.png"></label>
+ <label class="plugin-name"><%=_("Licence Agreement")-%> - <%= @eula.name -%></label>
+ </div>
-<div class="plugin-content" id="eula">
-<% form_for(:eula,
- :url => { :action => :update, :id => @eula_id },
- :html=> { :method => :put}
- ) do |f| -%>
-<fieldset>
- <div class="eula-text-area">
- <%= @eula.text.gsub(%r{^[\n\n$]}, '<p class="eula_paragraph">').gsub(%r{[\n]}, ' ')%>
+ <div class="clearfix"></div>
+ </div>
+
+ <div class="clearfix"> </div>
+
+ <fieldset class="webyast_fieldset eula_fieldset">
+ <div class="eula-text-area">
+ <%= @eula.text.gsub(%r{^[\n\n$]}, '<p class="eula_paragraph">').gsub(%r{[\n]}, ' ')%>
+ </div>
+
+ <div class="clearfix"> </div>
+
+ <% if @eula.only_show %>
+ <%= hidden_field_tag :accepted, "true" %>
+ <% else %>
+ <div class="fieldset_body eula_fieldset_body">
+ <div class="row">
+ <%= f.radio_button :accepted, :true, :checked => @eula.accepted, :readonly => disabled, :disabled => disabled %>
+ <%= _("Yes, I agree to the license agreement.") %>
+ </div>
+ <div class="row">
+ <%= f.radio_button :accepted, :false, :checked => (! @eula.accepted), :readonly => disabled, :disabled => disabled %>
+ <%= _("No, I do not agree.") %>
+ </div>
+ <% end -%>
+ <% unless @eula.text_lang == 'en' then %>
+ <%= f.hidden_field :text_lang %>
+ <% end %>
+ </fieldset>
+
+ <div class="clearfix"></div>
+
+ <div class="button_container">
+ <div class="hr"> </div>
+ <div class="nav-buttons">
+ <%= form_next_button :disabled => disabled %>
+ <%= if @first_eula
+ @first_basesystem_step ? "" : (form_str_spacer + form_back_button )
+ else
+ form_str_spacer + (link_to _("Back"), :action => :show, :id => @prev_id)
+ end %>
+ </div>
</div>
-
- <% if @eula.only_show %>
- <%= hidden_field_tag :accepted, "true" %>
- <% else %>
- <p>
- <%= f.radio_button :accepted, :true, :checked => @eula.accepted, :readonly => disabled, :disabled => disabled %>
- <%= _("Yes, I agree to the license agreement.") %>
- <p></p>
- <%= f.radio_button :accepted, :false, :checked => (! @eula.accepted), :readonly => disabled, :disabled => disabled %>
- <%= _("No, I do not agree.") %>
- </p>
- <% end -%>
- <% unless @eula.text_lang == 'en' then %>
- <%= f.hidden_field :text_lang %>
- <% end %>
-</fieldset>
-<div class="nav-buttons">
- <%= form_next_button :disabled => disabled %>
- <%= if @first_eula
- @first_basesystem_step ? "" : (form_str_spacer + form_back_button )
- else
- form_str_spacer + (link_to _("Back"), :action => :show, :id => @prev_id)
- end %>
-</div>
<% end -%>
</div>
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-licenses-ws for openSUSE:Factory
checked in at Wed May 4 11:11:00 CEST 2011.
--------
--- webyast-licenses-ws/webyast-licenses-ws.changes 2011-02-09 10:47:43.000000000 +0100
+++ /mounts/work_src_done/STABLE/webyast-licenses-ws/webyast-licenses-ws.changes 2011-04-12 15:10:25.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Apr 12 13:09:29 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.3
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-licenses-ws.spec ++++++
--- /var/tmp/diff_new_pack.3K9J3v/_old 2011-05-04 11:10:00.000000000 +0200
+++ /var/tmp/diff_new_pack.3K9J3v/_new 2011-05-04 11:10:00.000000000 +0200
@@ -26,7 +26,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.2
+Version: 0.2.3
Release: 1
Summary: WebYaST - license management service
Source: www.tar.bz2
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/config/resources/eulas.yml new/www/config/resources/eulas.yml
--- old/www/config/resources/eulas.yml 2010-08-27 14:58:55.000000000 +0200
+++ new/www/config/resources/eulas.yml 2011-04-11 12:49:05.000000000 +0200
@@ -2,4 +2,9 @@
interface: org.opensuse.yast.modules.eulas
controller: eulas
singular: false
-
+#cache:
+# enabled: true/false
+# priority: -100..100
+# reload_after: seconds (0 == do not reload)
+cache:
+ enabled: false
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-mail-ws for openSUSE:Factory
checked in at Wed May 4 11:06:53 CEST 2011.
--------
--- webyast-mail-ws/webyast-mail-ws.changes 2011-03-09 13:11:58.000000000 +0100
+++ /mounts/work_src_done/STABLE/webyast-mail-ws/webyast-mail-ws.changes 2011-05-03 11:00:05.000000000 +0200
@@ -1,0 +2,18 @@
+Tue May 3 08:59:17 UTC 2011 - schubi(a)novell.com
+
+- adapted deleting cache key
+- 0.2.6
+
+-------------------------------------------------------------------
+Mon May 2 12:31:05 UTC 2011 - schubi(a)novell.com
+
+- adapt caching to the new job handling
+- 0.2.5
+
+-------------------------------------------------------------------
+Tue Apr 12 13:16:29 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.4
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-mail-ws.spec ++++++
--- /var/tmp/diff_new_pack.z9gW5v/_old 2011-05-04 11:06:38.000000000 +0200
+++ /var/tmp/diff_new_pack.z9gW5v/_new 2011-05-04 11:06:38.000000000 +0200
@@ -26,7 +26,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.3
+Version: 0.2.6
Release: 1
Summary: WebYaST - system mail settings service
Source: www.tar.bz2
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/mail/state_controller.rb new/www/app/controllers/mail/state_controller.rb
--- old/www/app/controllers/mail/state_controller.rb 2011-03-08 11:47:08.000000000 +0100
+++ new/www/app/controllers/mail/state_controller.rb 2011-05-02 16:35:51.000000000 +0200
@@ -33,7 +33,7 @@
logger.warn "Confirmation of testmail"
File.delete Mail::TEST_MAIL_FILE if File.exist? Mail::TEST_MAIL_FILE
-
+ YastCache.delete(Plugin.new(),"mail")
mail = Mail.find
respond_to do |format|
format.xml { render :xml => mail.to_xml(:root => "mail", :dasherize => false, :indent=>2), :location => "none" }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/mail.rb new/www/app/models/mail.rb
--- old/www/app/models/mail.rb 2011-03-09 12:50:15.000000000 +0100
+++ new/www/app/models/mail.rb 2011-04-29 18:23:25.000000000 +0200
@@ -37,10 +37,12 @@
# read the settings from system
def self.find
- yapi_ret = YastService.Call("YaPI::MailSettings::Read")
- raise MailError.new("Cannot read from YaPI backend") if yapi_ret.nil?
- yapi_ret["transport_layer_security"] = yapi_ret.delete("TLS") || "no"
- Mail.new yapi_ret
+ YastCache.fetch(self) {
+ yapi_ret = YastService.Call("YaPI::MailSettings::Read")
+ raise MailError.new("Cannot read from YaPI backend") if yapi_ret.nil?
+ yapi_ret["transport_layer_security"] = yapi_ret.delete("TLS") || "no"
+ Mail.new yapi_ret
+ }
end
@@ -56,6 +58,7 @@
yapi_ret = YastService.Call("YaPI::MailSettings::Write", parameters)
Rails.logger.debug "YaPI returns: '#{yapi_ret}'"
+ YastCache.reset(self)
raise MailError.new(yapi_ret) unless yapi_ret.empty?
true
end
@@ -69,7 +72,6 @@
# remove potential problematic characters from email address
to.tr!("~'\"<>","")
-
`/bin/echo "#{message}" | /bin/mail -s "WebYaST Test Mail" '#{to}' -r root`
unless File.directory? File.join(Paths::VAR,"mail")
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-network-ws for openSUSE:Factory
checked in at Wed May 4 11:01:55 CEST 2011.
--------
--- webyast-network-ws/webyast-network-ws.changes 2011-02-09 09:18:49.000000000 +0100
+++ /mounts/work_src_done/STABLE/webyast-network-ws/webyast-network-ws.changes 2011-05-02 14:36:15.000000000 +0200
@@ -1,0 +2,19 @@
+Mon May 2 12:34:35 UTC 2011 - schubi(a)novell.com
+
+- adapt caching to the new job handling
+- 0.2.4
+
+-------------------------------------------------------------------
+Tue Apr 12 13:18:01 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.3
+
+-------------------------------------------------------------------
+Mon Mar 28 13:49:35 UTC 2011 - vlewin(a)novell.com
+
+- undefined method `bootproto' for #<Interface:0xb67416c8> (bnc#645231)
+- setting DHCP mode doesn't work for interface eth1
+- 0.2.2
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-network-ws.spec ++++++
--- /var/tmp/diff_new_pack.ulFCMD/_old 2011-05-04 11:01:31.000000000 +0200
+++ /var/tmp/diff_new_pack.ulFCMD/_new 2011-05-04 11:01:31.000000000 +0200
@@ -28,7 +28,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.1
+Version: 0.2.4
Release: 1
Summary: WebYaST - Network service
Source: www.tar.bz2
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/network/dns_controller.rb new/www/app/controllers/network/dns_controller.rb
--- old/www/app/controllers/network/dns_controller.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/app/controllers/network/dns_controller.rb 2011-04-11 12:49:05.000000000 +0200
@@ -37,7 +37,7 @@
root["searches"] = (root["searches"] || "").split
root["nameservers"] = (root["nameservers"] || "").split
- @dns = DNS.new(root)
+ @dns = Dns.new(root)
@dns.save!
show
end
@@ -49,7 +49,7 @@
# Shows hostname settings. Requires read permission for network YaPI.
def show
- @dns = DNS.find
+ @dns = Dns.find
respond_to do |format|
format.xml { render :xml => @dns.to_xml( :root => "dns", :dasherize => false ) }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/dns.rb new/www/app/models/dns.rb
--- old/www/app/models/dns.rb 2011-02-01 10:49:11.000000000 +0100
+++ new/www/app/models/dns.rb 2011-04-29 18:23:25.000000000 +0200
@@ -18,11 +18,12 @@
# To contact Novell about this file by physical or electronic mail,
# you may find current contact information at www.novell.com
#++
-# = DNS model
+# = Dns model
# Provides set and gets resources from YaPI network module.
# Main goal is handle YaPI specific calls and data formats. Provides cleaned
# and well defined data.
-class DNS < BaseModel::Base
+
+class Dns < BaseModel::Base
# the short hostname
attr_accessor :searches
@@ -54,9 +55,11 @@
# fills time instance with data from YaPI.
#
# +warn+: Doesn't take any parameters.
- def DNS.find
- response = YastService.Call("YaPI::NETWORK::Read") # hostname: true
- ret = DNS.new response["dns"]
+ def Dns.find
+ YastCache.fetch(self) {
+ response = YastService.Call("YaPI::NETWORK::Read") # hostname: true
+ ret = Dns.new response["dns"]
+ }
end
# Saves data from model to system via YaPI. Saves only setted data,
@@ -69,6 +72,7 @@
vsettings = [ "a{sas}", settings ] # bnc#538050
YastService.Call("YaPI::NETWORK::Write",{"dns" => vsettings})
# TODO success or not?
+ YastCache.reset(self)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/hostname.rb new/www/app/models/hostname.rb
--- old/www/app/models/hostname.rb 2011-02-01 10:49:11.000000000 +0100
+++ new/www/app/models/hostname.rb 2011-04-29 18:23:25.000000000 +0200
@@ -22,6 +22,7 @@
# Provides set and gets resources from YaPI network module.
# Main goal is handle YaPI specific calls and data formats. Provides cleaned
# and well defined data.
+
class Hostname < BaseModel::Base
# the short hostname
@@ -36,8 +37,10 @@
#
# +warn+: Doesn't take any parameters.
def self.find
- response = YastService.Call("YaPI::NETWORK::Read") # hostname: true
- Hostname.new response["hostname"]
+ YastCache.fetch(self) {
+ response = YastService.Call("YaPI::NETWORK::Read") # hostname: true
+ Hostname.new response["hostname"]
+ }
end
# Saves data from model to system via YaPI. Saves only setted data,
@@ -52,6 +55,7 @@
vsettings = [ "a{ss}", settings ] # bnc#538050
YastService.Call("YaPI::NETWORK::Write",{"hostname" => vsettings})
# TODO success or not?
+ YastCache.reset(self)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/interface.rb new/www/app/models/interface.rb
--- old/www/app/models/interface.rb 2011-02-01 10:49:11.000000000 +0100
+++ new/www/app/models/interface.rb 2011-05-02 11:48:18.000000000 +0200
@@ -22,6 +22,7 @@
# Provides set and gets resources from YaPI network module.
# Main goal is handle YaPI specific calls and data formats. Provides cleaned
# and well defined data.
+
class Interface < BaseModel::Base
IPADDR_REGEX = /([0-9]{1,3}.){3}[0-9]{1,3}/
@@ -40,24 +41,27 @@
def initialize(args, id=nil)
super args
@id ||= id
- @ipaddr ||= ""
+ #@ipaddr ||= "" causes exception if bootproto=dhcp: "Raised resource Invalid exception - #<InvalidParameters: Invalid arguments: {:ipaddr=>:invalid}>"
+ @ipaddr = bootproto == "dhcp" ? "" : ipaddr
+
end
def self.find( which )
- response = YastService.Call("YaPI::NETWORK::Read")
- ifaces_h = response["interfaces"]
- if which == :all
- ret = Hash.new
- ifaces_h.each do |id, ifaces_h|
- ret[id] = Interface.new(ifaces_h, id)
+ YastCache.fetch(self, which) {
+ response = YastService.Call("YaPI::NETWORK::Read")
+ ifaces_h = response["interfaces"]
+ if which == :all
+ ret = Hash.new
+ ifaces_h.each do |id, ifaces_h|
+ ret[id] = Interface.new(ifaces_h, id)
+ end
+ else
+ ret = Interface.new(ifaces_h[which], which)
end
- else
- ret = Interface.new(ifaces_h[which], which)
- end
- return ret
+ ret
+ }
end
-
# Saves data from model to system via YaPI. Saves only setted data,
# so it support partial safe (e.g. save only new timezone if rest of fields is not set).
def update
@@ -74,6 +78,7 @@
vsettings = [ "a{sa{ss}}", settings ] # bnc#538050
YastService.Call("YaPI::NETWORK::Write",{"interface" => vsettings})
# TODO success or not?
+ YastCache.reset(self,@id)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/route.rb new/www/app/models/route.rb
--- old/www/app/models/route.rb 2011-02-01 10:49:11.000000000 +0100
+++ new/www/app/models/route.rb 2011-05-02 10:22:45.000000000 +0200
@@ -22,6 +22,7 @@
# Provides set and gets resources from YaPI network module.
# Main goal is handle YaPI specific calls and data formats. Provides cleaned
# and well defined data.
+
class Route < BaseModel::Base
# default gateway
@@ -44,17 +45,20 @@
#
# +warn+: YaPI implements default only.
def self.find( which )
- response = YastService.Call("YaPI::NETWORK::Read")
- routes_h = response["routes"]
- if which == :all
- ret = Hash.new
- routes_h.each do |id, route_h|
- ret[id] = Route.new(route_h, id)
+ which = "default" if which == :all
+ YastCache.fetch(self,which) {
+ response = YastService.Call("YaPI::NETWORK::Read")
+ routes_h = response["routes"]
+ if which == :all
+ ret = Hash.new
+ routes_h.each do |id, route_h|
+ ret[id] = Route.new(route_h, id)
+ end
+ else
+ ret = Route.new(routes_h[which], which)
end
- else
- ret = Route.new(routes_h[which], which)
- end
- return ret
+ ret
+ }
end
# Saves data from model to system via YaPI. Saves only setted data,
@@ -66,6 +70,7 @@
}
vsettings = [ "a{sa{ss}}", settings ] # bnc#538050
ret = YastService.Call("YaPI::NETWORK::Write",{"route" => vsettings})
+ YastCache.reset(self,@id)
raise RouteError.new(ret["error"]) if ret["exit"] != "0"
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/test/functional/dns_controller_test.rb new/www/test/functional/dns_controller_test.rb
--- old/www/test/functional/dns_controller_test.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/test/functional/dns_controller_test.rb 2011-04-11 12:49:05.000000000 +0200
@@ -24,14 +24,14 @@
class DnsControllerTest < ActionController::TestCase
def setup
- @model_class = DNS
- # FIXME: bad mock for DNS (field name mismatch):
- # DNS.stubs(:find).returns(DNS.new({"BAD" => ["d1", "d2"], "KEYS"=> ["s1", "s2"]}))
+ @model_class = Dns
+ # FIXME: bad mock for Dns (field name mismatch):
+ # Dns.stubs(:find).returns(Dns.new({"BAD" => ["d1", "d2"], "KEYS"=> ["s1", "s2"]}))
# in test_access_show_xml:
# add assert_response :success)
# in case of error: give a nicer error than 500
- DNS.stubs(:find).returns(DNS.new({"searches" => ["d1", "d2"], "nameservers" => ["s1", "s2"]}))
+ Dns.stubs(:find).returns(Dns.new({"searches" => ["d1", "d2"], "nameservers" => ["s1", "s2"]}))
@controller = Network::DnsController.new
@request = ActionController::TestRequest.new
# http://railsforum.com/viewtopic.php?id=1719
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/test/unit/dns_test.rb new/www/test/unit/dns_test.rb
--- old/www/test/unit/dns_test.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/test/unit/dns_test.rb 2011-04-11 12:49:05.000000000 +0200
@@ -21,7 +21,7 @@
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
-class DNSTest < ActiveSupport::TestCase
+class DnsTest < ActiveSupport::TestCase
RESPONSE_FULL = {
'interfaces'=>{
@@ -37,13 +37,13 @@
end
def test_index
- dns = DNS.find
+ dns = Dns.find
assert_instance_of Array, dns.searches
assert_instance_of Array, dns.nameservers
end
def test_validations
- dns = DNS.find
+ dns = Dns.find
assert dns.valid?
dns.nameservers = ["<danger script>"]
assert dns.invalid?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/test/unit/route_test.rb new/www/test/unit/route_test.rb
--- old/www/test/unit/route_test.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/test/unit/route_test.rb 2011-04-11 12:49:05.000000000 +0200
@@ -44,9 +44,8 @@
def test_index
routes = Route.find(:all)
- assert_instance_of Hash, routes
- route = routes["default"]
- assert_equal 'default', route.id
+ assert_instance_of Route, routes
+ assert_equal 'default', routes.id
end
def test_validations
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-ntp-ws for openSUSE:Factory
checked in at Wed May 4 11:01:23 CEST 2011.
--------
--- webyast-ntp-ws/webyast-ntp-ws.changes 2011-02-09 10:36:45.000000000 +0100
+++ /mounts/work_src_done/STABLE/webyast-ntp-ws/webyast-ntp-ws.changes 2011-05-02 14:38:24.000000000 +0200
@@ -1,0 +2,12 @@
+Mon May 2 12:38:17 UTC 2011 - schubi(a)novell.com
+
+- adapt caching to the new job handling
+- 0.2.3
+
+-------------------------------------------------------------------
+Tue Apr 12 13:19:36 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.2
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-ntp-ws.spec ++++++
--- /var/tmp/diff_new_pack.J7E2RE/_old 2011-05-04 11:00:54.000000000 +0200
+++ /var/tmp/diff_new_pack.J7E2RE/_new 2011-05-04 11:00:54.000000000 +0200
@@ -31,7 +31,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.1
+Version: 0.2.3
Release: 1
Summary: WebYaST - NTP service
Source: www.tar.bz2
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/ntp.rb new/www/app/models/ntp.rb
--- old/www/app/models/ntp.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/models/ntp.rb 2011-04-29 18:23:25.000000000 +0200
@@ -26,12 +26,14 @@
public
def self.find
- ret = Ntp.new
- ret.actions ||= {}
- ret.actions[:synchronize] = false
- ret.actions[:synchronize_utc] = true
- ret.actions[:ntp_server] = get_servers_string
- return ret
+ YastCache.fetch(self) {
+ ret = Ntp.new
+ ret.actions ||= {}
+ ret.actions[:synchronize] = false
+ ret.actions[:synchronize_utc] = true
+ ret.actions[:ntp_server] = get_servers_string
+ ret
+ }
end
def update
@@ -39,7 +41,7 @@
end
def self.get_servers
- get_servers_string
+ Ntp.find.actions[:ntp_server]
end
private
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-permissions-ui for openSUSE:Factory
checked in at Wed May 4 11:00:43 CEST 2011.
--------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-permissions-ui.spec ++++++
--- /var/tmp/diff_new_pack.KWk3bt/_old 2011-05-04 10:56:26.000000000 +0200
+++ /var/tmp/diff_new_pack.KWk3bt/_new 2011-05-04 10:56:26.000000000 +0200
@@ -28,7 +28,7 @@
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
Version: 0.1.8
-Release: 1
+Release: 6
Summary: WebYaST - Permissions UI
Source: www.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-reboot-ui for openSUSE:Factory
checked in at Wed May 4 10:56:18 CEST 2011.
--------
--- webyast-reboot-ui/webyast-reboot-ui.changes 2010-08-30 12:34:29.000000000 +0200
+++ /mounts/work_src_done/STABLE/webyast-reboot-ui/webyast-reboot-ui.changes 2011-04-12 16:40:12.000000000 +0200
@@ -1,0 +2,6 @@
+Tue Apr 12 14:39:51 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.2
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-reboot-ui.spec ++++++
--- /var/tmp/diff_new_pack.cVjrtP/_old 2011-05-04 10:56:01.000000000 +0200
+++ /var/tmp/diff_new_pack.cVjrtP/_new 2011-05-04 10:56:01.000000000 +0200
@@ -26,7 +26,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.1
+Version: 0.2.2
Release: 1
Summary: WebYaST - reboot/shutdown UI
Source: www.tar.bz2
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/system_controller.rb new/www/app/controllers/system_controller.rb
--- old/www/app/controllers/system_controller.rb 2010-05-28 09:52:16.000000000 +0200
+++ new/www/app/controllers/system_controller.rb 2011-02-07 12:45:40.000000000 +0100
@@ -39,7 +39,7 @@
else
flash[:error] = _("Cannot reboot the machine!")
end
- rescue ActiveResource::ResourceNotFound => e #FIXME system returns 404 in case of error. use 422 and proper formated xml
+ rescue ActiveResource::ResourceNotFound => e #FIXME system returns 404 in case of error. use 422 and proper formated xml RORSCAN_ITL
logger.warn "Cannot reboot: #{e.inspect}"
flash[:error] = _("Cannot reboot the machine!")
end
@@ -60,7 +60,7 @@
else
flash[:error] = _("Cannot shutdown the machine!")
end
- rescue ActiveResource::ResourceNotFound => e #FIXME system returns 404 in case of error. use 422 and proper formated xml
+ rescue ActiveResource::ResourceNotFound => e #FIXME system returns 404 in case of error. use 422 and proper formated xml RORSCAN_ITL
logger.warn "Cannot shutdown: #{e.inspect}"
flash[:error] = _("Cannot shutdown the machine!")
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/system.rb new/www/app/models/system.rb
--- old/www/app/models/system.rb 2010-05-28 09:52:16.000000000 +0200
+++ new/www/app/models/system.rb 2011-02-07 12:45:40.000000000 +0100
@@ -22,7 +22,7 @@
class System
def initialize
- @client = YaST::ServiceResource.proxy_for('org.opensuse.yast.system.system')
+ @client = YaST::ServiceResource.proxy_for('org.opensuse.yast.system.system') # RORSCAN_ITL
@sys = @client.find
end
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-reboot-ws for openSUSE:Factory
checked in at Wed May 4 10:55:53 CEST 2011.
--------
--- webyast-reboot-ws/webyast-reboot-ws.changes 2010-08-23 16:38:48.000000000 +0200
+++ /mounts/work_src_done/STABLE/webyast-reboot-ws/webyast-reboot-ws.changes 2011-04-19 14:33:51.000000000 +0200
@@ -1,0 +2,13 @@
+Tue Apr 12 13:33:13 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.2
+
+-------------------------------------------------------------------
+Thu Nov 25 14:14:10 UTC 2010 - lslezak(a)suse.cz
+
+- fixed loosing permissions after upgrade from WebYaST-1.0
+ (bnc#645310)
+- 0.2.1
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-reboot-ws.spec ++++++
--- /var/tmp/diff_new_pack.nk6TMH/_old 2011-05-04 10:53:54.000000000 +0200
+++ /var/tmp/diff_new_pack.nk6TMH/_new 2011-05-04 10:53:54.000000000 +0200
@@ -28,7 +28,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.0
+Version: 0.2.2
Release: 1
Summary: WebYaST - reboot/shutdown service
Source: www.tar.bz2
@@ -89,7 +89,11 @@
%clean
rm -rf $RPM_BUILD_ROOT
-%post
+# %posttrans is used instead of %post so it ensures the rights are
+# granted even after upgrading from old package (before renaming) (bnc#645310)
+# (see https://fedoraproject.org/wiki/Packaging/ScriptletSnippets#Syntax )
+
+%posttrans
# granting all permissions for the web user
#FIXME don't silently fail
polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.hal.power-management.shutdown >& /dev/null || true
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/system.rb new/www/app/models/system.rb
--- old/www/app/models/system.rb 2010-07-15 10:31:45.000000000 +0200
+++ new/www/app/models/system.rb 2011-02-01 10:49:25.000000000 +0100
@@ -57,14 +57,14 @@
# connect to the system bus
# Make a fresh connection, to be able to reboot
# after DBus is restarted, bnc#582759
- system_bus = DBus::SystemBus.send :new
+ system_bus = DBus::SystemBus.send :new # RORSCAN_ITL
# get the HAL service
- hal_service = system_bus.service('org.freedesktop.Hal')
+ hal_service = system_bus.service('org.freedesktop.Hal') # RORSCAN_ITL
computer = hal_service.object('/org/freedesktop/Hal/devices/computer')
computer.introspect
- computer.default_iface = 'org.freedesktop.Hal.Device.SystemPowerManagement'
+ computer.default_iface = 'org.freedesktop.Hal.Device.SystemPowerManagement' # RORSCAN_ITL
case action
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-roles-ui for openSUSE:Factory
checked in at Wed May 4 10:53:46 CEST 2011.
--------
--- webyast-roles-ui/webyast-roles-ui.changes 2010-09-28 12:44:19.000000000 +0200
+++ /mounts/work_src_done/STABLE/webyast-roles-ui/webyast-roles-ui.changes 2011-04-12 16:32:24.000000000 +0200
@@ -1,0 +2,15 @@
+Tue Apr 12 14:31:26 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.2.9
+
+-------------------------------------------------------------------
+Fri Jan 14 10:02:58 UTC 2011 - vgorobets(a)novell.com
+
+- New UI design
+- cleaned up javascripts and stylesheets
+- partially moved inline javascript in separate file
+- compleately moved inline css to new_input.css
+- 0.2.8
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-roles-ui.spec ++++++
--- /var/tmp/diff_new_pack.rkIUxg/_old 2011-05-04 10:50:15.000000000 +0200
+++ /var/tmp/diff_new_pack.rkIUxg/_new 2011-05-04 10:50:15.000000000 +0200
@@ -27,7 +27,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.2.7
+Version: 0.2.9
Release: 1
Summary: WebYaST - Roles management UI
Source: www.tar.bz2
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/roles_controller.rb new/www/app/controllers/roles_controller.rb
--- old/www/app/controllers/roles_controller.rb 2010-09-15 13:17:51.000000000 +0200
+++ new/www/app/controllers/roles_controller.rb 2011-01-19 10:41:48.000000000 +0100
@@ -37,7 +37,7 @@
end
def self.users_role_id (role_id)
- "users_of_" + role_id.gsub(/ /,".") #replace space which cannot be in id - http://www.w3.org/TR/html4/types.html#type-name
+ "users_of_" + role_id.gsub(/ /,"_") #replace space which cannot be in id - http://www.w3.org/TR/html4/types.html#type-name
end
def self.permission_role_id (permission_id, role_id)
@@ -52,8 +52,7 @@
all_permissions = all_permissions.collect {|p| PrefixedPermission.new(p.id, p.description)}
# create an [[key,value]] array of prefixed permissions, where key is the prefix
@prefixed_permissions = PrefixedPermissions.new(all_permissions).sort
- @all_users_string = (User.find(:all,:params => {:getent => "1"}).collect {|user| user.login}).sort.join(",")
- Rails.logger.info @all_users_string
+ @all_users_string = (User.find(:all,:params => {:getent => "1"}).collect {|user| user.login}).sort
end
# Update time handler. Sets to backend new timezone and time.
@@ -65,6 +64,7 @@
YastModel::Permission.password = YaST::ServiceResource::Session.auth_token
all_permissions = YastModel::Permission.find(:all).collect {|p| p.id }
changed_roles = []
+
@roles.each do |role|
new_permissions = all_permissions.find_all do |perm|
params[RolesController.permission_role_id perm, role.name]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/views/roles/index.rhtml new/www/app/views/roles/index.rhtml
--- old/www/app/views/roles/index.rhtml 2010-09-16 09:46:59.000000000 +0200
+++ new/www/app/views/roles/index.rhtml 2011-04-12 13:05:56.000000000 +0200
@@ -20,230 +20,73 @@
# you may find current contact information at www.novell.com
#++
%>
-<% content_for :head do %>
-<% if JSMIN == true %>
- <%= javascript_include_tag "users-min.js"-%>
- <% else %>
- <%= javascript_include_tag "select_dialog.js" %>
- <% end %>
-<% end%>
-
-<style type="text/css">
- label.error {
- display:block;
- font-size:11px;
- font-weight:bold;
- color:#990000;
- vertical-align:middle;
- padding:0px;
- margin:0px;
- }
- input.error { float: none;}
-
- /*Patch to support height: 'auto'*/
- .ui-dialog-content {
- overflow-y: auto;
- }
-</style>
-
-<% content_for :before_script do %>
- <% javascript_tag do %>
- function groupedFields(group_role_id) {
- var header_check = $(".permissions-group-header .permission-field[group-role-id='"+group_role_id+"'] input")[0];
- var field_checks = $(".permissions-group-content .permission-field[group-role-id='"+group_role_id+"'] input").get();
- return { header : header_check, fields : field_checks };
- };
- function all(items, cond) {
- items_length = items.length;
- for (var i=0;i<items_length;i++) {
- if (!cond(items[i])) { return false }
- };
- return true;
- };
- function allChecked(checks, status) {
- return all(checks, function(ch) { return ch.checked == status });
- };
- function allCheckedSame(checks) {
- return (allChecked(checks,true) || allChecked(checks,false));
- };
- function groupHeaderClicked( group_header ) {
- var group = groupedFields(group_header.parent().attr('group-role-id'));
- if (group_header.hasClass('computed')) {
- group.fields.map( function(f){f.checked = group_header[0].checked} )
- group_header.removeClass('computed');
- $(group.fields).addClass('computed');
- } else {
- group.fields.map( function(f){ f.checked = group_header[0].checked } );
- }
- };
- function refreshComputed(group_role_id) {
- group = groupedFields( group_role_id );
- if (allCheckedSame(group.fields)) {
- $(group.header).removeClass('computed');
- $(group.fields).addClass('computed');
- group.header.checked = group.fields[0].checked;
- } else {
- $(group.header).addClass('computed');
- $(group.fields).removeClass('computed');
- group.header.checked = true;
- }
- };
- function groupFieldClicked( group_field ) {
- refreshComputed(group_field.parent().attr('group-role-id'));
- };
- function collapseAll() {
- $('.list-fieldset-header').next().hide();
- };
- function select_users_dialog() {
- var open_dialog = select_many_dialog({
- kind : 'users',
- title : <%= jss _('Assign Users') %>,
- selected_title : <%= jss _('Selected Users') %>,
- unselected_title : <%= jss _('Available Users') %>,
- tooltip : <%= jss _('Click user names to assign/remove users') %>,
- loadItems : function (dialogId) {
- return $('#users_of_'+dialogId.replace(/ /g,"\\."))[0].value.split(",")
- },
- storeItems : function (dialogId, items) {
- $('#users_of_'+dialogId.replace(/ /g,"\\."))[0].value = items.join(",");
- },
- allItems : function (dialogId) {
- return $('#all_users_string')[0].value.split(",")
- }
- });
- return open_dialog;
- };
-
- $(document).ready(function() {
- function validateRoleName(name)
- {
- jQuery.validator.addMethod(name, function(value, element) {
- var regExp = new RegExp("^[a-zA-Z0-9\\_\\-\\. ]+$");
- return this.optional(element) || regExp.test(value);
- });
- }
-
- validateRoleName("role_name");
- $("#rolesForm").validate({
- onkeyup: function(element) { this.element(element); },
- rules:{
- role_name: { required:true, role_name: true }
- },
- messages: {
- role_name: {
- required: <%= jss _("This field is required") -%>,
- role_name: <%= jss _("Allowed is combination of a-z, A-Z, numbers, space, dash and underscore only.") -%>
- }
- }
- });
- });
-
- function clearForm() {
- $("#role_name").val('');
- $("#rolesForm label.error")
- .val('')
- .css("display", "none");
- }
-
- function create_role_dialog() {
- $("#create_role_dialog").dialog({
- autoOpen: false,
- width: 400,
- modal: true,
- close: clearForm,
- buttons: {
- 'Create Role': function() {
- if ($("#rolesForm").validate().form() == true) {
- $(this).children("form").first().submit();
- }
- },
- Cancel: function() {
- $(this).dialog('close');
- }
- }
- });
- };
-
-
- $(document).ready(function(){
- select_users_open = select_users_dialog();
- $(".permissions-group-header .permission-field input").click( function() {
- groupHeaderClicked($(this));
- });
- $(".permissions-group-content .permission-field input").click( function() {
- groupFieldClicked( $(this) );
- });
- $(".permissions-group-header .permission-field").map( function() { refreshComputed( this.getAttribute('group-role-id') ) });
- $('.list-fieldset-header .permission-label').click(function() {
- $(this).parent().next().toggle();
- return false;
- });
- $('.permissions-header .permission-label').click( collapseAll );
- addTabsNavigation(".fieldset-group", "span");
- $(".fieldset-group").tabs();
-
- create_role_dialog();
-
- $("#create_role_link").click( function (e) {
- e.preventDefault();
- $("#create_role_dialog").dialog('open');
- });
-
- // disable whole form on submit
- $("#roles_submit_button").click( function () {
- var message = "<%= _("Please wait") -%>";
- disableFormOnSubmit(message);
- });
- });
-
-
-
-
- <% end %>
-
-<style>
- .permission-label {
- width: 22em;
- float: left;
- cursor: pointer;
- }
- .permission-field, .role-label {
- width: 8em;
- float: left;
- text-align: center;
- }
- .permissions-content, .permissions-group-row {
- clear: left;
- }
- .permissions-group-row .permission-label {
- margin-left: 2em;
- width: 20em;
- }
- .permissions-header {
- margin: 0em 1.5em;
- }
- input.computed {
- opacity: 0.5;
- }
-</style>
-
-<% end %>
-
-<div class='plugin-icon'><img src='/icons/yast-permissions.png' alt="Roles module"/><%=_("Roles")%></div>
+<div class='plugin-icon'><img src='/icons/yast-permissions.png' alt="Roles module"/><%=_("Roles")%><span id="questionMark">?</span></div>
<div class="plugin-content">
- <div class="nav-buttons">
- <%= link_to (_("Create Role") ),
- {},
- {:id => 'create_role_link'} %>
- </div>
<div id="create_role_dialog" style="display: none">
<% form_tag '/roles/create', {:id=>'rolesForm', :class => 'container'} do %>
- <label for="role_name"> Name </label><%= text_field_tag "role_name", "", :class=>"required"%>
+ <label for="role_name">Name</label><%= text_field_tag "role_name", "", :class=>"required"%>
<% end %>
</div>
- <% form_tag '/roles/update', {:class => 'container'} do %>
- <div class="fieldset-group">
+
+ <% form_tag '/roles/update', { :id=>'rolesUpdateForm', :class => 'container'} do %>
+ <span id="toolbox">
+ <img id="loupe" src="../images/loupe.png">
+ <input type="text" id="find_user" autocomplete="off">
+ <img id="resetSearchField" class="resetSearch" src="../images/reset-search.png">
+ <span id="loader"><img src='/images/spinner.gif'></span>
+ <%= link_to (_("Create Role") ), {}, {:id => 'create_role_link', :class=>'round3' } %>
+ </span>
+
+ <div id="jqueryTab" class="fieldset-group">
+ <fieldset id="assignUsers">
+ <legend><span><%= _("Assign Users")%></span></legend>
+ <div id="rolesContainer">
+ <div id="rolesContent" class="round5b">
+ <% @roles.each do |role| %>
+ <div class="role">
+ <span class="roleHeader" style="vertical-align:middle;">
+ <label><img class="role" src="../images/key-grey.png"><%= role.name%></label>
+ <%= link_to image_tag("../images/delete-user.png", :border=>0, :class=>"deleteRole"), {:action => 'destroy', :id => ERB::Util.html_escape( role.name ) }, { :style=>"border:0px;"} %>
+ </span>
+ <span class="roleBody drop">
+ <span class="roles_warning" style="display:none; float:left;"> user already assigned to this role</span>
+ <%=hidden_field_tag(RolesController.users_role_id(role.name), role.users.join(",") ) %>
+ <% role.users.each do |user| %>
+ <span class="user assigned" alt="<%=RolesController.users_role_id(role.name)%>"><%=user%></span>
+ <% end %>
+ </span>
+ </div>
+ <% end %>
+ </div>
+ </div>
+
+ <div id="usersContainer">
+ <div id="usersContent" class="users round5b">
+ <div class="slider-content">
+ <ol>
+ <% @tmp = Array.new %>
+ <% @all_users_string.each_with_index do |elem, i|%>
+ <% unless @tmp.index(elem[0,1]) != nil %>
+ <% if i == 0 %>
+ <% @alpha = "'" + elem[0,1] + "'" %>
+ <li id="<%= elem[0,1] %>" class="title"><%= elem[0,1] %></li><ol class="wrapper"><li>
+ <% else %>
+ <% @alpha += ",'" + elem[0,1] + "'" %>
+ </li></ol><li id="<%= elem[0,1] %>" class="title"><%= elem[0,1] %></li><ol class="wrapper"><li>
+ <% end %>
+ <% @tmp.push(elem[0,1]) %>
+ <span class="drag user"><%= elem %></span>
+ <% else %>
+ <span class="drag user"><%= elem %></span>
+ <% end %>
+ <% end %>
+ </ol>
+ </div>
+ </div>
+ </div>
+ </fieldset>
+
<fieldset id="assign-permissions">
<legend><span><%= _("Assign Permissions")%></span></legend>
<div>
@@ -253,60 +96,200 @@
<span class="role-label"><%= role.name %></span>
<% end %>
</div>
+
<div class="permissions-content">
<% @prefixed_permissions.each do |prefix,permissions| %>
<div class="list-fieldset">
+
<div class="permissions-group-header list-fieldset-header">
<span class="permission-label"><%= prefix %></span>
<% @roles.each do |role| %>
<span class="permission-field" group-role-id="<%= RolesController.permission_role_id prefix, role.name %>">
- <%= check_box_tag( RolesController.permission_role_id( prefix, role.name),
- "1" ) %>
+ <%= check_box_tag( RolesController.permission_role_id( prefix, role.name), "1" ) %>
</span>
<% end %>
<div style="clear:both"></div>
</div>
+
<div class="permissions-group-content">
<% permissions.each do |permission| %>
<div class="permissions-group-row">
<span class="permission-label"><%= permission.short_name %></span>
<% @roles.each do |role| %>
<span class="permission-field" group-role-id="<%= RolesController.permission_role_id prefix, role.name %>">
- <%= check_box_tag( RolesController.permission_role_id( permission.full_name, role.name ),
- "1",
- role.permissions.include?( permission.full_name) ) %>
+ <%= check_box_tag( RolesController.permission_role_id( permission.full_name, role.name ), "1", role.permissions.include?( permission.full_name) ) %>
</span>
<% end %>
</div>
<% end %>
- <div style="clear:both"></div>
+ <div style="clear:both"></div>
</div>
</div>
<% end %>
</div>
</div>
</fieldset>
- <fieldset id="assign-users">
- <legend><span><%= _("Assign Users")%></span></legend>
- <div>
- <% @roles.each do |role| %>
- <p>
- <label><%= role.name%></label>
- <%=text_field_tag( RolesController.users_role_id(role.name), role.users.join(",")) %>
- <a href="#" onClick="select_users_open('<%= role.name %>');return false;", class="button"><%= _("Assign Users") %></a>
- <%= link_to _("Delete"), #"<img src='/images/delete.png'>",
- {:action => 'destroy', :id => ERB::Util.html_escape( role.name ) }, { :class=>:button } %>
-
- </p>
- <% end %>
- <input type="hidden" id="all_users_string" value="<%= @all_users_string %>" />
- </div>
- </fieldset>
</div>
+
<div class="nav-buttons">
<%= form_next_button (:id=>'roles_submit_button') %>
<%= form_str_spacer %>
<%= form_back_button %>
</div>
<% end %>
+
+ <script type="text/javascript">
+ var AUTH_TOKEN = 'authenticity_token=' + encodeURIComponent("<%= escape_javascript form_authenticity_token %>");
+ startNotifier({'module':'roles', 'AUTH_TOKEN':AUTH_TOKEN}, 1000, 11000);
+
+ $(document).ready(function(){
+ function validateRoleName(name) {
+ jQuery.validator.addMethod(name, function(value, element) {
+ var regExp = new RegExp("^[a-zA-Z0-9\\_\\-\\. ]+$");
+ return this.optional(element) || regExp.test(value);
+ });
+ }
+ validateRoleName("role_name");
+ $("#rolesForm").validate({
+ onkeyup: function(element) { this.element(element); },
+ rules:{ role_name: { required:true, role_name: true } },
+ messages: {
+ role_name: { required: <%= jss _("This field is required") -%>, role_name: <%= jss _("Allowed is combination of a-z, A-Z, numbers, space, dash and underscore only.") -%> }
+ }
+ });
+
+// select_users_open = select_users_dialog();
+ $(".permissions-group-header .permission-field input").click( function() {
+ groupHeaderClicked($(this));
+ });
+ $(".permissions-group-content .permission-field input").click( function() {
+ groupFieldClicked( $(this) );
+ });
+ $(".permissions-group-header .permission-field").map( function() { refreshComputed( this.getAttribute('group-role-id') ) });
+ $('.list-fieldset-header .permission-label').click(function() {
+ $(this).parent().next().toggle();
+ return false;
+ });
+ $('.permissions-header .permission-label').click( collapseAll );
+ addTabsNavigation("div#jqueryTab", "span");
+ $("div#jqueryTab").tabs();
+
+ create_role_dialog();
+
+ $("#create_role_link").click( function (e) {
+ e.preventDefault();
+ $("#create_role_dialog").dialog('open');
+ });
+
+ $("#roles_submit_button").click( function () { blockForm(); });
+ $("img.deleteRole").click( function () { blockForm(); });
+
+ $('#usersContent').sliderNav({items:[<%= @alpha %>], arrows:false });
+ });
+
+ function clearForm() {
+ $("#role_name").val('');
+ $("#rolesForm label.error").val('').css("display", "none");
+ }
+
+ function create_role_dialog() {
+ $("#create_role_dialog").dialog({
+ autoOpen: false,
+ width: 400,
+ modal: true,
+ close: clearForm,
+ buttons: {
+ 'Create Role': function() {
+ if ($("#rolesForm").validate().form() == true) {
+ $(this).children("form").first().submit();
+ $(this).dialog('close');
+ blockForm();
+ }
+ },
+ Cancel: function() {
+ $(this).dialog('close');
+ }
+ }
+ });
+ };
+
+ function blockForm() {
+ var message = "<%= _("Please wait") -%>";
+ disableFormOnSubmit(message);
+ }
+
+ function groupedFields(group_role_id) {
+ var header_check = $(".permissions-group-header .permission-field[group-role-id='"+group_role_id+"'] input")[0];
+ var field_checks = $(".permissions-group-content .permission-field[group-role-id='"+group_role_id+"'] input").get();
+ return { header : header_check, fields : field_checks };
+ };
+ function all(items, cond) {
+ items_length = items.length;
+ for (var i=0;i<items_length;i++) {
+ if (!cond(items[i])) { return false }
+ };
+ return true;
+ };
+ function allChecked(checks, status) {
+ return all(checks, function(ch) { return ch.checked == status });
+ };
+ function allCheckedSame(checks) {
+ return (allChecked(checks,true) || allChecked(checks,false));
+ };
+ function groupHeaderClicked( group_header ) {
+ var group = groupedFields(group_header.parent().attr('group-role-id'));
+ if (group_header.hasClass('computed')) {
+ group.fields.map( function(f){f.checked = group_header[0].checked} )
+ group_header.removeClass('computed');
+ $(group.fields).addClass('computed');
+ } else {
+ group.fields.map( function(f){ f.checked = group_header[0].checked } );
+ }
+ };
+ function refreshComputed(group_role_id) {
+ group = groupedFields( group_role_id );
+ if (allCheckedSame(group.fields)) {
+ $(group.header).removeClass('computed');
+ $(group.fields).addClass('computed');
+ group.header.checked = group.fields[0].checked;
+ } else {
+ $(group.header).addClass('computed');
+ $(group.fields).removeClass('computed');
+ group.header.checked = true;
+ }
+ };
+ function groupFieldClicked( group_field ) {
+ refreshComputed(group_field.parent().attr('group-role-id'));
+ };
+ function collapseAll() {
+ $('.list-fieldset-header').next().hide();
+ };
+// function select_users_dialog() {
+// var open_dialog = select_many_dialog({
+// kind : 'users',
+// title : <%= jss _('Assign Users') %>,
+// selected_title : <%= jss _('Selected Users') %>,
+// unselected_title : <%= jss _('Available Users') %>,
+// tooltip : <%= jss _('Click user names to assign/remove users') %>,
+// loadItems : function (dialogId) {
+// return $('#users_of_'+dialogId.replace(/ /g,"\\."))[0].value.split(",")
+// },
+// storeItems : function (dialogId, items) {
+// $('#users_of_'+dialogId.replace(/ /g,"\\."))[0].value = items.join(",");
+// },
+// allItems : function (dialogId) {
+// return $('#all_users_string')[0].value.split(",")
+// }
+// });
+// return open_dialog;
+// };
+ </script>
+
+ <% content_for :head do %>
+ <% if JSMIN == true %>
+ <%= javascript_include_tag "users-min.js"-%>
+ <% else %>
+ <%= javascript_include_tag "select_dialog", "jquery.event.drag-2.0.min", "jquery.event.drop-2.0.min", "jquery.qsearch", "roles.helper", "slidernav" %>
+ <% end %>
+ <% end%>
</div>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0
Hello community,
here is the log from the commit of package webyast-software-ws for openSUSE:Factory
checked in at Wed May 4 10:49:27 CEST 2011.
--------
--- webyast-software-ws/webyast-software-ws.changes 2011-02-09 10:19:23.000000000 +0100
+++ /mounts/work_src_done/STABLE/webyast-software-ws/webyast-software-ws.changes 2011-05-03 11:01:41.000000000 +0200
@@ -1,0 +2,24 @@
+Tue May 3 09:01:34 UTC 2011 - schubi(a)novell.com
+
+- adapted deleting cache key
+- 0.3.5
+
+-------------------------------------------------------------------
+Mon May 2 12:43:38 UTC 2011 - schubi(a)novell.com
+
+- adapt caching to the new job handling
+- 0.3.4
+
+-------------------------------------------------------------------
+Tue Apr 12 13:29:12 UTC 2011 - schubi(a)novell.com
+
+- new caching
+- 0.3.3
+
+-------------------------------------------------------------------
+Fri Feb 11 09:42:29 UTC 2011 - jreidinger(a)novell.com
+
+- fix installing patches which require EULA confirmation
+ (bnc#669470)
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ webyast-software-ws.spec ++++++
--- /var/tmp/diff_new_pack.1Mx9xm/_old 2011-05-04 10:46:53.000000000 +0200
+++ /var/tmp/diff_new_pack.1Mx9xm/_new 2011-05-04 10:46:53.000000000 +0200
@@ -48,7 +48,7 @@
Group: Productivity/Networking/Web/Utilities
Url: http://en.opensuse.org/Portal:WebYaST
AutoReqProv: on
-Version: 0.3.2
+Version: 0.3.5
Release: 1
Summary: WebYaST - software management service
Source: www.tar.bz2
@@ -128,7 +128,7 @@
%endif
%endif
-mkdir -p $RPM_BUILD_ROOT/var/lib/yastws/software
+mkdir -p $RPM_BUILD_ROOT/var/lib/yastws/software/licenses/accepted
%clean
rm -rf $RPM_BUILD_ROOT
@@ -143,6 +143,7 @@
# grant the permission for the webservice user
polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.packagekit.system-sources-configure >& /dev/null || true
polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.packagekit.system-update >& /dev/null || true
+polkit-auth --user %{webyast_ws_user} --grant org.freedesktop.packagekit.package-eula-accept >& /dev/null || true
%files
%defattr(-,root,root)
@@ -159,7 +160,6 @@
%{plugin_dir}/uninstall.rb
%{plugin_dir}/app
%{plugin_dir}/lib
-%{plugin_dir}/scripts
%{plugin_dir}/config
%attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.system.patches.policy
%attr(644,root,root) %config /usr/share/PolicyKit/policy/org.opensuse.yast.system.packages.policy
++++++ www.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/packages_controller.rb new/www/app/controllers/packages_controller.rb
--- old/www/app/controllers/packages_controller.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/app/controllers/packages_controller.rb 2011-04-11 12:49:05.000000000 +0200
@@ -25,13 +25,8 @@
before_filter :login_required
- # always check permissions and cache expiration
- # even if the result is already created and cached
+ # always check permissions
before_filter :check_read_permissions, :only => {:index, :show}
- before_filter :check_cache_status, :only => :index
-
- # cache 'index' method result
- caches_action :index
private
@@ -39,24 +34,6 @@
permission_check "org.opensuse.yast.system.patches.read"
end
- # check whether the cached result is still valid
- def check_cache_status
- cache_timestamp = Rails.cache.read('patches:timestamp')
-
- if cache_timestamp.nil?
- # this is the first run, the cache is not initialized yet, just return
- Rails.cache.write('patches:timestamp', Time.now)
- return
- # the cache expires after 5 minutes, repository metadata
- # or RPM database update invalidates the cache immeditely
- # (new patches might be applicable)
- elsif cache_timestamp < 5.minutes.ago || cache_timestamp < Patch.mtime
- logger.debug "#### Patch cache expired"
- expire_action :action => :index, :format => params["format"]
- Rails.cache.write('patches:timestamp', Time.now)
- end
- end
-
def compare_lists(packages)
vendor_packages = Array.new
#TODO: replace by real yml file
@@ -73,8 +50,8 @@
public
- # GET /patch_updates
- # GET /patch_updates.xml
+ # GET /packages
+ # GET /packages.xml
def index
# note: permission check was performed in :before_filter
@packages = Package.find(:installed)
@@ -87,13 +64,13 @@
end
end
- # GET /patch_updates/1
- # GET /patch_updates/1.xml
+ # GET /packages/1
+ # GET /packages/1.xml
def show
end
- # PUT /patch_updates/1
- # PUT /patch_updates/1.xml
+ # PUT /packages/1
+ # PUT /packages/1.xml
def update
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/patch_update/state_controller.rb new/www/app/controllers/patch_update/state_controller.rb
--- old/www/app/controllers/patch_update/state_controller.rb 2010-09-17 16:25:41.000000000 +0200
+++ new/www/app/controllers/patch_update/state_controller.rb 2011-05-02 16:34:56.000000000 +0200
@@ -33,7 +33,7 @@
logger.warn "Confirmation of reading patch messages"
File.delete Patch::MESSAGES_FILE
-
+ YastCache.delete(Plugin.new(),"patch")
respond_to do |format|
format.xml { head :ok }
format.json { head :ok }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/patches_controller.rb new/www/app/controllers/patches_controller.rb
--- old/www/app/controllers/patches_controller.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/controllers/patches_controller.rb 2011-04-20 12:44:33.000000000 +0200
@@ -25,15 +25,8 @@
before_filter :login_required
- # always check permissions and cache expiration
- # even if the result is already created and cached
+ # always check permissions
before_filter :check_read_permissions, :only => [:index, :show]
- before_filter :check_cache_status, :only => :index
-
- # cache 'index' method result, but don't cache message requests
- # (caching messages would complicate the cache invalidation code
- # and it's fast anyway so it is actually not important)
- caches_action :index, :unless => Proc.new { |ctrl| ctrl.params['messages'] }
private
@@ -41,72 +34,38 @@
permission_check "org.opensuse.yast.system.patches.read" # RORSCAN_ITL
end
- # check whether the cached result is still valid
- def check_cache_status
- #cache contain string as it is only object supported by all caching backends
- cache_timestamp = Rails.cache.read('patches:timestamp').to_i
-
- if cache_timestamp.nil?
- # this is the first run, the cache is not initialized yet, just return
- Rails.cache.write('patches:timestamp', Time.now.to_i.to_s)
- # the cache expires after 5 minutes, repository metadata
- # or RPM database update invalidates the cache immediately
- # (new patches might be applicable)
- elsif cache_timestamp < 15.minutes.ago.to_i || cache_timestamp < Patch.mtime.to_i
- logger.debug "#### Patch cache expired"
- expire_action :action => :index, :format => params["format"]
- Rails.cache.write('patches:timestamp', Time.now.to_i.to_s)
- end
- end
-
def collect_done_patches
done = []
+ installed = Rails.cache.fetch("patch:installed") || []
+ installed.each { |patch_id|
+ # e.g.: 'suse-build-key;1.0-907.30;noarch;@System'
+ attrs = patch_id.split(';')
+ done << Patch.new(:resolvable_id => attrs[1],
+ :name => attrs[0],
+ :arch => attrs[2],
+ :repo => attrs[3],
+ :installed => true)
+ }
+ return done
+ end
- BackgroundManager.instance.done.each do |k,v|
- if k.match(/^packagekit_install_(.*)/)
- patch_id = $1
- if BackgroundManager.instance.process_finished? k
- Rails.logger.debug "Patch installation request #{patch_id} is done"
- ret = BackgroundManager.instance.get_value k
-
- # check for exception
- if ret.is_a? StandardError
- raise ret
- end
-
- # e.g.: 'suse-build-key;1.0-907.30;noarch;@System'
- attrs = patch_id.split(';')
-
- done << Patch.new(:resolvable_id => attrs[1],
- :name => attrs[0],
- :arch => attrs[2],
- :repo => attrs[3],
- :installed => true)
- end
- end
+ def check_license_required
+ if PatchesState.read[:message_id] == "PATCH_EULA"
+ raise LicenseRequiredException.new
end
-
- return done
end
- def check_running_install
+ def check_running_install
running = 0
- max_progress = nil
- status = nil
- BackgroundManager.instance.running.each do |k,v|
- if k.match(/^packagekit_install_(.*)/)
- patch_id = $1
- tmp = BackgroundManager.instance.get_progress k
- if max_progress.nil? || tmp.progress > max_progress
- max_progress = tmp.progress
- status = tmp
- end
- logger.info "installation in progress. Patch #{k}"
- running += 1
- end
- end
- raise InstallInProgressException.new running,status if running > 0 #there is process which runs installation
- end
+ jobs = Delayed::Job.find(:all)
+ jobs.each { |job|
+ running += 1 if job.handler.split("\n")[1].split[1].include?("patch:install:")
+ } unless jobs.blank?
+ Rails.logger.info("#{running} installation jobs in the queue")
+ Rails.cache.delete("patch:installed") if running == 0 #remove installed patches from cache if the installation
+ #has been finished
+ raise InstallInProgressException.new running if running > 0 #there is process which runs installation
+ end
def read_messages
if File.exists?(Patch::MESSAGES_FILE)
@@ -132,23 +91,22 @@
end
return
end
- check_running_install
+ if params[:license].present?
+ respond_to do |format|
+ format.xml { render :xml => Patch.license.to_xml( :root => "licenses", :dasherize => false ) }
+ format.json { render :json => Patch.license.to_json( :root => "licenses", :dasherize => false ) }
+ end
+ return
+ end
+ check_license_required
+ check_running_install
# note: permission check was performed in :before_filter
- bgr = params['background']
- Rails.logger.info "Reading patches in background" if bgr
-
- @patches = Patch.find(:available, {:background => bgr})
+ @patches = Patch.find(:all)
@patches = @patches + collect_done_patches #report also which patches is installed
respond_to do |format|
format.xml { render :xml => @patches.to_xml( :root => "patches", :dasherize => false ) }
format.json { render :json => @patches.to_json( :root => "patches", :dasherize => false ) }
end
-
- # do not cache the background progress status
- # (expire the cache in the next request)
- if bgr && @patches.first.class == BackgroundStatus
- Rails.cache.write('patches:timestamp', Time.at(0))
- end
end
# GET /patch_updates/1
@@ -179,8 +137,13 @@
# POST /patch_updates/
def create
permission_check "org.opensuse.yast.system.patches.install" # RORSCAN_ITL
- @patch_update = Patch.find(params[:patches][:resolvable_id].to_s)
+ if params[:patches][:accept_license].present? || params[:patches][:reject_license].present?
+ params[:patches][:accept_license].present? ? Patch.accept_license : Patch.reject_license
+ index
+ return
+ end
+ @patch_update = Patch.find(params[:patches][:resolvable_id].to_s)
#Patch for Bug 560701 - [build 24.1] webYaST appears to crash after installing webclient patch
#Packagekit returns empty string if the patch is allready installed.
if @patch_update.is_a?(Array) && @patch_update.empty?
@@ -194,8 +157,7 @@
end
res = @patch_update.install(true) #always install in backend otherwise there is problem with long running updates
- Rails.cache.write('patches:timestamp', Time.at(0)) #invalidate cache
- index
+ render :show
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/controllers/repositories_controller.rb new/www/app/controllers/repositories_controller.rb
--- old/www/app/controllers/repositories_controller.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/controllers/repositories_controller.rb 2011-04-27 15:12:09.000000000 +0200
@@ -22,31 +22,10 @@
class RepositoriesController < ApplicationController
before_filter :login_required
-
- # cache index and show action
- before_filter :check_cache_status, :only => [:index]
before_filter :check_read_permissions, :only => [:index]
- caches_action :index
-
- CACHE_ID = 'repositories:timestamp'
private
- # check whether the cached result is still valid
- def check_cache_status
- cache_timestamp = Rails.cache.read(CACHE_ID)
-
- if cache_timestamp.nil?
- # this is the first run, the cache is not initialized yet, just return
- Rails.cache.write(CACHE_ID, Time.now)
- # the cache expires when /etc/zypp/repos.d is modified
- elsif cache_timestamp < Repository.mtime
- Rails.logger.debug "#### Repositories cache expired"
- expire_action :action => :index, :format => params["format"]
- Rails.cache.write(CACHE_ID, Time.now)
- end
- end
-
def check_read_permissions
permission_check "org.opensuse.yast.system.repositories.read" # RORSCAN_ITL
end
@@ -154,4 +133,4 @@
render :show
end
-end
\ No newline at end of file
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/package.rb new/www/app/models/package.rb
--- old/www/app/models/package.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/models/package.rb 2011-05-02 09:49:37.000000000 +0200
@@ -28,20 +28,23 @@
end
def self.find(what)
+ what = :installed if what == :all #default search for cache
if what == :installed
- package_list = Array.new
- self.execute("GetPackages", what.to_s, "Package") { |line1,line2,line3| # RORSCAN_ITL
- columns = line2.split ";"
- package = Package.new(:resolvable_id => line2,
- :name => columns[0],
- :version => columns[1]
- )
- # :arch => columns[2],
- # :repo => columns[3],
- # :summary => line3 )
- package_list << package
- }
- package_list
+ YastCache.fetch(self,what) {
+ package_list = Array.new
+ PackageKit.transact("GetPackages", what.to_s, "Package") { |line1,line2,line3| # RORSCAN_ITL
+ columns = line2.split ";"
+ package = Package.new(:resolvable_id => line2,
+ :name => columns[0],
+ :version => columns[1]
+ )
+ # :arch => columns[2],
+ # :repo => columns[3],
+ # :summary => line3 )
+ package_list << package
+ }
+ package_list
+ }
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/patch.rb new/www/app/models/patch.rb
--- old/www/app/models/patch.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/app/models/patch.rb 2011-04-29 18:23:25.000000000 +0200
@@ -27,370 +27,227 @@
attr_accessor :messages
MESSAGES_FILE = File.join(Paths::VAR,"software","patch_installion_messages")
+ LICENSES_DIR = File.join(Paths::VAR,"software","licenses")
+ ACCEPTED_LICENSES_DIR = File.join(Paths::VAR,"software","licenses","accepted")
+ JOB_PRIO = -30
private
- # just a short cut for accessing the singleton object
- def self.bm
- BackgroundManager.instance
+ def self.decide_license(accept)
+ #we don't know eula id, but as it block package kit, then there is only one license file to decide
+ if accept
+ `find #{LICENSES_DIR} -type f -exec mv {} #{ACCEPTED_LICENSES_DIR} \\;`
+ else
+ `find #{LICENSES_DIR} -type f -delete`
+ end
end
- # create unique id for the background manager
- def self.id(what)
- "patches_#{what}"
+ public
+
+ def self.accept_license
+ decide_license true
end
- public
+ def self.reject_license
+ decide_license false
+ end
def to_xml( options = {} )
super :patch_update, options, @messages
end
# install
- def install(background=false)
- @messages=[]
+ def install(background = false)
+ # background process doesn't work correctly if class reloading is active
+ # (static class members are lost between requests)
+ # So the job queue is also not active
+ if background && !YastCache.job_queue_enabled?
+ Rails.logger.info "Job queue is not active. Disable background mode"
+ background = false
+ end
update_id = "#{self.name};#{self.resolvable_id};#{self.arch};#{self.repo}"
Rails.logger.error "Install Update: #{update_id}"
- Patch.install(update_id, background, ['RequireRestart','Message']) { |type, details|
- Rails.logger.info "Message signal received: #{type}, #{details}"
- @messages << {:kind => type, :details => details}
- begin
- dirname = File.dirname(MESSAGES_FILE)
- FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
- f = File.new(MESSAGES_FILE, 'a+')
- f.puts '<br/>' unless File.size(MESSAGES_FILE).zero?
- # TODO: make the message traslatable
- f.puts "#{details}"
- rescue Exception => e
- Rails.logger.error "writing #{MESSAGES_FILE} file failed: #{e.try(:message)}"
- ensure
- f.try(:close)
- end
- }
+ unless background
+ Patch.install(update_id) #install at once
+ else
+ #inserting job in background
+ Rails.logger.info("Inserting job #{key}")
+ PluginJob.run_async(JOB_PRIO, :Patch, :install, update_id )
+ Delayed::Job.enqueue(PluginJob.new(key),JOB_PRIO)
+ end
end
# find patches using PackageKit
- def self.do_find(what, bg_status = nil)
+ def self.do_find(what)
+ bg_status = nil #not needed due caching
patch_updates = Array.new
- PackageKit.transact("GetUpdates", "none", "Package", bg_status) { |line1,line2,line3|
- columns = line2.split ";"
- if what == :available || columns[1] == what
- update = Patch.new(:resolvable_id => columns[1],
- :kind => line1,
- :name => columns[0],
- :arch => columns[2],
- :repo => columns[3],
- :summary => line3 )
-
- if what == :available
- # add the update to the list
- patch_updates << update
- else
- # just return this single update
- patch_updates = update
- end
- end
- }
- return patch_updates
- end
-
- def self.subprocess_find(what)
- # open subprocess
- subproc = open_subprocess :find, what
-
- result = nil
-
- while !eof_subprocess?(subproc) do
- begin
- line = read_subprocess subproc
-
- unless line.blank?
- received = Hash.from_xml(line)
-
- # is it a progress or the final list?
- if received.has_key? 'patches'
- Rails.logger.debug "Found #{received['patches'].size} patches"
- # create Patch objects
- result = received['patches'].map{|patch| Patch.new(patch.symbolize_keys) }
- elsif received.has_key? 'background_status'
- s = received['background_status']
-
- bm.update_progress id(what) do |bs|
- bs.status = s['status']
- bs.progress = s['progress']
- bs.subprogress = s['subprogress']
- end
- elsif received.has_key? 'error'
- return PackageKitError.new(received['error']['description'])
+ PackageKit.lock #locking
+ begin
+ PackageKit.transact("GetUpdates", "none", "Package", bg_status) { |line1,line2,line3|
+ columns = line2.split ";"
+ if what == :available || columns[1] == what
+ update = Patch.new(:resolvable_id => columns[1],
+ :kind => line1,
+ :name => columns[0],
+ :arch => columns[2],
+ :repo => columns[3],
+ :summary => line3 )
+
+ if what == :available
+ # add the update to the list
+ patch_updates << update
else
- Rails.logger.warn "*** Patch thread: Received unknown input: #{line}"
+ # just return this single update
+ patch_updates = update
end
end
- rescue Exception => e
- Rails.logger.error "Background thread: Could not evaluate output: #{line.chomp}, exception: #{e}" # RORSCAN_ITL
- Rails.logger.error "Background thread: Backtrace: #{e.backtrace.join("\n")}"
-
- # rethrow the exception
- raise e
- end
+ }
+ ensure
+ #unlocking PackageKit
+ PackageKit.unlock
end
-
- result
+ return patch_updates
end
# find patches
# Patch.find(:available)
- # Patch.find(:available, :background => true) - read patches in background
- # the result may the current state (progress) or the actual patch list
- # call this function in a loop until a patch list (or an error) is received
# Patch.find(212)
def self.find(what, opts = {})
- background = opts[:background]
-
- # background reading doesn't work correctly if class reloading is active
- # (static class members are lost between requests)
- if background && !bm.background_enabled?
- Rails.logger.info "Class reloading is active, cannot use background thread (set config.cache_classes = true)"
- background = false
- end
-
- if background
- proc_id = id(what)
- if bm.process_finished? proc_id
- Rails.logger.debug "Request #{proc_id} is done"
- ret = bm.get_value proc_id
-
- # check for exception
- if ret.is_a? StandardError
- raise ret
- end
-
- return ret
- end
-
- running = bm.get_progress proc_id
- if running
- Rails.logger.debug "Request #{proc_id} is already running: #{running.inspect}"
- return [running]
- end
-
-
- bm.add_process proc_id
-
- Rails.logger.info "Starting background thread for reading patches..."
- # run the patch query in a separate thread
- Thread.new do
- res = subprocess_find what
-
- # check for exception
- unless res.is_a? StandardError
- Rails.logger.info "*** Patches thread: Found #{res.size} applicable patches"
- else
- Rails.logger.debug "*** Exception raised: #{res.inspect}"
- end
- bm.finish_process(proc_id, res)
- end
-
- return [ bm.get_progress(proc_id) ]
- else
- return do_find(what)
- end
+ search_id = what == :all ? :available : what
+ YastCache.fetch(self, what) {
+ do_find(search_id)
+ }
end
# install an update, based on the PackageKit
# id ("<name>;<id>;<arch>;<repo>")
- # signal: signal to intercept (usually "Package") (optional)
- # block: block to run on signal (optional)
#
- def self.install(pk_id, background = false, signal_list = nil, &block)
- Rails.logger.debug "Installing #{pk_id}, background: #{background.inspect}"
-
- # background process doesn't work correctly if class reloading is active
- # (static class members are lost between requests)
- bm = BackgroundManager.instance
- if background && !bm.background_enabled?
- Rails.logger.info "Class reloading is active, cannot use background thread (set config.cache_classes = true)"
- background = false
- end
- Rails.logger.debug "Background: #{background.inspect}"
-
- if background
- proc_id = bgid(pk_id)
-
- running = bm.get_progress proc_id
- if running
- Rails.logger.debug "Request #{proc_id} is already running: #{running.inspect}"
- return running
+ def self.install(pk_id)
+ Rails.logger.debug "Installing #{pk_id}"
+ @messages=[]
+ ret = do_install(pk_id,['RequireRestart','Message']) { |type, details|
+ Rails.logger.info "Message signal received: #{type}, #{details}"
+ @messages << {:kind => type, :details => details}
+ begin
+ dirname = File.dirname(MESSAGES_FILE)
+ FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
+ f = File.new(MESSAGES_FILE, 'a+')
+ f.puts '<br/>' unless File.size(MESSAGES_FILE).zero?
+ # TODO: make the message traslatable
+ f.puts "#{details}"
+ rescue Exception => e
+ Rails.logger.error "writing #{MESSAGES_FILE} file failed: #{e.try(:message)}"
+ ensure
+ f.try(:close)
end
+ }
+ #save installed patches in cache
+ i = Rails.cache.fetch("patch:installed") || []
+ installed = i.dup #cache is frozen
+ installed << pk_id
+ Rails.cache.write("patch:installed", installed)
+
+ YastCache.delete(self,pk_id.split(';')[1])
+ return ret
+ end
- bm.add_process proc_id
-
- Rails.logger.info "Starting background thread for installing patches..."
- # run the patch query in a separate thread
- Thread.new do
- @@package_kit_mutex ||= Mutex.new #TODO move to packagekit lib
- @@package_kit_mutex.synchronize do
- res = subprocess_install pk_id
-
- # check for exception
- unless res.is_a? StandardError
- Rails.logger.info "*** Patch install thread: Result: #{res.inspect}"
- else
- Rails.logger.debug "*** Patch install thread: Exception raised: #{res.inspect}"
- end
- bm.finish_process(proc_id, res)
- end
+ def self.license
+ Dir.glob(File.join(LICENSES_DIR,"*")).reduce([]) do |res,f|
+ if File.file? f
+ res << ({
+ :name => File.basename(f),
+ :text => File.read(f)
+ })
end
-
- return bm.get_progress(proc_id)
- else
- return do_install(pk_id,signal_list,&block)
+ res
end
end
+
def self.do_install(pk_id, signal_list = [], &block)
+ #locking PackageKit for single use
+ PackageKit.lock
+
ok = true
- transaction_iface, packagekit_iface = PackageKit.connect
+ begin
+ transaction_iface, packagekit_iface = PackageKit.connect
- proxy = transaction_iface.object
+ proxy = transaction_iface.object
- if block_given?
- signal_list.each { |signal|
- # set the custom signal handle
- proxy.on_signal(signal.to_s, &block)
- }
- end
-
- proxy.on_signal("Package") do |line1,line2,line3|
- Rails.logger.debug " update package: #{line2}"
- end
-
- error = ''
- dbusloop = PackageKit.dbusloop proxy, error
- dbusloop << proxy.bus
-
- proxy.on_signal("Error") do |u1,u2|
- ok = false
- dbusloop.quit
- end
- if transaction_iface.methods["UpdatePackages"] && # catch mocking
- transaction_iface.methods["UpdatePackages"].params.size == 2 &&
- transaction_iface.methods["UpdatePackages"].params[0][0] == "only_trusted"
- #PackageKit of 11.2
- transaction_iface.UpdatePackages(true, #only_trusted
- [pk_id])
- else
- #PackageKit older versions like SLES11
- transaction_iface.UpdatePackages([pk_id])
- end
-
- dbusloop.run
- packagekit_iface.SuggestDaemonQuit
-
- ok &= error.blank?
-
- # bnc#617350, remove signals
- proxy.on_signal "Error"
- proxy.on_signal "Package"
- if block_given?
- signal_list.each { |signal|
- proxy.on_signal signal.to_s
- }
- end
-
- return ok
- end
-
-private
-
- def self.bgid(what)
- "packagekit_install_#{what}"
- end
-
- def self.subprocess_script(type)
- file = case type
- when :find then "list_patches.rb"
- when :install then "install_patches.rb"
- else raise "unsupported type"
- end
- # find the helper script
- script = File.join(RAILS_ROOT, 'vendor/plugins/software/scripts',file) # RORSCAN_ITL
-
- unless File.exists? script # RORSCAN_ITL
- script = File.join(RAILS_ROOT, '../plugins/software/scripts',file) # RORSCAN_ITL
-
- unless File.exists? script # RORSCAN_ITL
- raise "File software/scripts/#{file} was not found!" # RORSCAN_ITL
+ if block_given?
+ signal_list.each { |signal|
+ # set the custom signal handle
+ proxy.on_signal(signal.to_s, &block)
+ }
+ end
+
+ proxy.on_signal("Package") do |line1,line2,line3|
+ Rails.logger.debug " update package: #{line2}"
+ end
+
+ error = ''
+ dbusloop = PackageKit.dbusloop proxy, error
+ dbusloop << proxy.bus
+
+ proxy.on_signal("Error") do |u1,u2|
+ ok = false
+ dbusloop.quit
+ end
+ proxy.on_signal("EulaRequired") do |eula_id,package_id,vendor_name,license_text|
+ #FIXME check if user already agree with license
+ if handle_eula(eula_id,license_text)
+ PackageKit.transact :AcceptEula, [eula_id],nil,nil
+ PackageKit.transact :UpdatePackages, [[pk_id]], nil, nil
+ dbusloop.quit
+ else
+ ok = false
+ dbusloop.quit
+ end
end
+ if transaction_iface.methods["UpdatePackages"] && # catch mocking
+ transaction_iface.methods["UpdatePackages"].params.size == 2 &&
+ transaction_iface.methods["UpdatePackages"].params[0][0] == "only_trusted"
+ #PackageKit of 11.2
+ transaction_iface.UpdatePackages(true, #only_trusted
+ [pk_id])
+ else
+ #PackageKit older versions like SLES11
+ transaction_iface.UpdatePackages([pk_id])
+ end
+
+ dbusloop.run
+
+ ok &= error.blank?
+
+ # bnc#617350, remove signals
+ proxy.on_signal "Error"
+ proxy.on_signal "Package"
+ proxy.on_signal "EulaRequired"
+ if block_given?
+ signal_list.each { |signal|
+ proxy.on_signal signal.to_s
+ }
+ end
+ ensure
+ #unlocking PackageKit
+ PackageKit.unlock
end
- Rails.logger.debug "Using #{script} script file" # RORSCAN_ITL
- script
- end
-
- def self.subprocess_command(type,what)
- raise "Invalid parameter" if what.to_s.include?("'") or what.to_s.include?('\\')
- ret = "cd #{RAILS_ROOT} && RAILS_ENV=#{ENV['RAILS_ENV'] || 'development'} #{File.join(RAILS_ROOT, 'script/runner')} #{subprocess_script type} "
- ret = ret + "'#{what}'" if type == :install #only install use specified patches
- return ret
- end
-
- # IO functions moved to separate methods for easy mocking/testing
-
- def self.open_subprocess(type,what)
- IO.popen subprocess_command(type,what)
- end
-
- def self.read_subprocess(subproc)
- subproc.readline
+ return ok
end
- def self.eof_subprocess?(subproc)
- subproc.eof?
+ def self.handle_eula(eula_id,license_text)
+ #TODO check if user already accept exactly same license
+ license_file = File.join(LICENSES_DIR,eula_id)
+ File.open(license_file,"w") { |f| f.write license_text }
+ while File.exists?(license_file)
+ sleep 1 #prevent turning server into radiator
+ end
+ accepted_path = File.join(ACCEPTED_LICENSES_DIR,eula_id)
+ ret = File.exists?(accepted_path) #eula is in accepted dir
+ File.delete accepted_path if ret #require new confirmation every patch same as zypper
+ ret
end
- def self.subprocess_install(what)
- # open subprocess
- subproc = open_subprocess :install, what
-
- result = nil
-
- while !eof_subprocess?(subproc) do
- begin
- line = read_subprocess subproc
-
- unless line.blank?
- received = Hash.from_xml(line)
-
- # is it a progress or the final list?
- if received.has_key? 'patch_installation'
- Rails.logger.debug "Received background patch installation result: #{received['patch_installation'].inspect}"
- # create Patch objects
- result = received['patch_installation']['result']
- elsif received.has_key? 'background_status'
- s = received['background_status']
-
- bm.update_progress bgid(what) do |bs|
- bs.status = s['status']
- bs.progress = s['progress']
- bs.subprogress = s['subprogress']
- end
- elsif received.has_key? 'error'
- return PackageKitError.new(received['error']['description'])
- else
- Rails.logger.warn "*** Patch installtion thread: Received unknown input: #{line}"
- end
- end
- rescue Exception => e
- Rails.logger.error "Background thread: Could not evaluate output: #{line.chomp}, exception: #{e}" # RORSCAN_ITL
- Rails.logger.error "Background thread: Backtrace: #{e.backtrace.join("\n")}"
-
- # rethrow the exception
- raise e
- end
- end
-
- result
- end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/patches_state.rb new/www/app/models/patches_state.rb
--- old/www/app/models/patches_state.rb 2010-09-17 16:23:35.000000000 +0200
+++ new/www/app/models/patches_state.rb 2011-04-20 11:40:23.000000000 +0200
@@ -24,7 +24,21 @@
class PatchesState
include GetText
def self.read()
- if File.exist? Patch::MESSAGES_FILE
+ licenses_to_confirm = Dir.glob(File.join(Patch::LICENSES_DIR,"*")).select {|f| File.file? f}
+ if !licenses_to_confirm.empty?
+ file = licenses_to_confirm[0] #take first one
+ text = File.read file
+ return { :level => "warning",
+ :message_id => "PATCH_EULA",
+ :short_description => _("EULA accept required"),
+ :long_description => _("Package require accept specific EULA before its installation. Please follow bellowed link."),
+ :details => "",
+ :confirmation_host => "client",
+ :confirmation_link => "/patch_updates/license",
+ :confirmation_label => _("decide"),
+ :confirmation_kind => "link" }
+
+ elsif File.exist? Patch::MESSAGES_FILE
f = File.new(Patch::MESSAGES_FILE, 'r')
messages = f.gets(nil) || ""
@@ -32,13 +46,14 @@
:message_id => "PATCH_MESSAGES",
:short_description => _("Patch installation messages not confirmed"),
:long_description => messages,
- :details => "",
+ :details => "",
:confirmation_host => "service",
:confirmation_link => "/patch_update/state",
:confirmation_label => _("OK"),
- :confirmation_kind => "button" }
+ :confirmation_kind => "button" }
else
return {}
- end
+ end
end
+
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/app/models/repository.rb new/www/app/models/repository.rb
--- old/www/app/models/repository.rb 2010-12-13 11:21:27.000000000 +0100
+++ new/www/app/models/repository.rb 2011-04-29 18:23:25.000000000 +0200
@@ -63,22 +63,28 @@
end
def self.find(what)
- repositories = Array.new
-
- PackageKit.transact('GetRepoList', 'none', 'RepoDetail') { |id, name, enabled|
- Rails.logger.debug "RepoDetail signal received: #{id}, #{name}, #{enabled}"
-
- if what == :all || id == what
- repo = Repository.new(id, name, enabled)
- # read other attributes directly from *.repo file,
- # because PackageKit doesn't have API for that
- repo.read_file
-
- repositories << repo
+ YastCache.fetch(self,what) {
+ PackageKit.lock #locking
+ begin
+ repositories = Array.new
+
+ PackageKit.transact('GetRepoList', 'none', 'RepoDetail') { |id, name, enabled|
+ Rails.logger.debug "RepoDetail signal received: #{id}, #{name}, #{enabled}"
+
+ if what == :all || id == what
+ repo = Repository.new(id, name, enabled)
+ # read other attributes directly from *.repo file,
+ # because PackageKit doesn't have API for that
+ repo.read_file
+
+ repositories << repo
+ end
+ }
+ ensure
+ PackageKit.unlock #locking
end
+ repositories
}
-
- repositories
end
def self.mtime
@@ -152,29 +158,36 @@
#
def update
# create a new repository if it does not exist yet
- if !Repository.exists?(@id)
- Rails.logger.info "Adding a new repository '#{@id}': #{self.inspect}"
- PackageKit.transact('RepoSetData', [@id, 'add', @url])
- else
- Rails.logger.info "Modifying repository '#{@id}': #{self.inspect}"
- # set url
- PackageKit.transact('RepoSetData', [@id, 'url', @url])
- end
-
- # set enabled flag
- PackageKit.transact('RepoEnable', [@id, @enabled])
+ repo_exist = Repository.exists?(@id)
+ PackageKit.lock #locking
+ begin
+ unless repo_exist
+ Rails.logger.info "Adding a new repository '#{@id}': #{self.inspect}"
+ PackageKit.transact('RepoSetData', [@id, 'add', @url])
+ else
+ Rails.logger.info "Modifying repository '#{@id}': #{self.inspect}"
+ # set url
+ PackageKit.transact('RepoSetData', [@id, 'url', @url])
+ end
- # set priority
- PackageKit.transact('RepoSetData', [@id, 'prio', @priority.to_s])
+ # set enabled flag
+ PackageKit.transact('RepoEnable', [@id, @enabled])
- # set autorefresh
- PackageKit.transact('RepoSetData', [@id, 'refresh', @autorefresh.to_s])
+ # set priority
+ PackageKit.transact('RepoSetData', [@id, 'prio', @priority.to_s])
- # set name
- PackageKit.transact('RepoSetData', [@id, 'name', @name.to_s])
+ # set autorefresh
+ PackageKit.transact('RepoSetData', [@id, 'refresh', @autorefresh.to_s])
- # set keep_package
- PackageKit.transact('RepoSetData', [@id, 'keep', @keep_packages.to_s])
+ # set name
+ PackageKit.transact('RepoSetData', [@id, 'name', @name.to_s])
+
+ # set keep_package
+ PackageKit.transact('RepoSetData', [@id, 'keep', @keep_packages.to_s])
+ ensure
+ PackageKit.unlock #locking
+ end
+ YastCache.reset(self,@id)
end
#
@@ -182,8 +195,16 @@
#
def destroy
return false if @id.blank?
-
- PackageKit.transact('RepoSetData', [@id, 'remove', 'NONE'])
+ ret = false
+ PackageKit.lock #locking
+ begin
+ ret = PackageKit.transact('RepoSetData', [@id, 'remove', 'NONE'])
+ ensure
+ PackageKit.unlock #locking
+ return ret
+ end
+ YastCache.delete(self,@id)
+ return ret
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/config/resources/packages.yml new/www/config/resources/packages.yml
--- old/www/config/resources/packages.yml 2010-08-27 14:58:55.000000000 +0200
+++ new/www/config/resources/packages.yml 2011-04-11 12:49:05.000000000 +0200
@@ -1,2 +1,9 @@
interface: org.opensuse.yast.system.packages
controller: packages
+
+#cache:
+# enabled: true/false
+# priority: -100..100
+# reload_after: seconds (0 == do not reload)
+cache:
+ enabled: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/config/resources/patches.yml new/www/config/resources/patches.yml
--- old/www/config/resources/patches.yml 2010-08-27 14:58:55.000000000 +0200
+++ new/www/config/resources/patches.yml 2011-04-19 11:37:20.000000000 +0200
@@ -1,2 +1,11 @@
interface: org.opensuse.yast.system.patches
controller: patches
+
+#cache:
+# enabled: true/false
+# priority: -100..100
+# reload_after: seconds (0 == do not reload)
+cache:
+ enabled: true
+ priority: 20
+ reload_after: 360
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/lib/install_in_progress_exception.rb new/www/lib/install_in_progress_exception.rb
--- old/www/lib/install_in_progress_exception.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/lib/install_in_progress_exception.rb 2011-04-11 12:49:05.000000000 +0200
@@ -20,21 +20,19 @@
#++
class InstallInProgressException < BackendException
- def initialize(count,progress)
- @progress = progress
+ def initialize(count)
@count = count
- end
+ end
- def to_xml
+ def to_xml
xml = Builder::XmlMarkup.new({})
xml.instruct!
xml.error do
xml.type "PACKAGEKIT_INSTALL"
- xml.description "Cannot obtain patches, installation in progress. Remain #{@count} packages. Status of currently installed package #{(a)progress.progress}"
- xml.progress @progress
+ xml.description "Cannot obtain patches, installation in progress. Remain #{@count} packages."
xml.count @count, :type => "integer"
xml.bug false, :type => "boolean"
end
- end
+ end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/lib/license_required_exception.rb new/www/lib/license_required_exception.rb
--- old/www/lib/license_required_exception.rb 1970-01-01 01:00:00.000000000 +0100
+++ new/www/lib/license_required_exception.rb 2011-04-20 12:45:00.000000000 +0200
@@ -0,0 +1,37 @@
+#--
+# Copyright (c) 2009-2011 Novell, Inc.
+#
+# All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of version 2 of the GNU General Public License
+# as published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, contact Novell, Inc.
+#
+# To contact Novell about this file by physical or electronic mail,
+# you may find current contact information at www.novell.com
+#++
+
+class LicenseRequiredException < BackendException
+ def initialize
+ super "License confirm required to continue with installation. Please go to patch module, where you can decide about license confirmation."
+ end
+
+ def to_xml
+ xml = Builder::XmlMarkup.new({})
+ xml.instruct!
+
+ xml.error do
+ xml.type "PACKAGEKIT_LICENSE"
+ xml.description message
+ xml.bug false, :type => "boolean"
+ end
+ end
+end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/lib/packagekit.rb new/www/lib/packagekit.rb
--- old/www/lib/packagekit.rb 2011-02-01 10:49:25.000000000 +0100
+++ new/www/lib/packagekit.rb 2011-04-20 12:42:18.000000000 +0200
@@ -51,7 +51,7 @@
private
def self.improve_error(dbus_error)
# check if it is a known error
- if dbus_error.message =~ /org.freedesktop.DBus.Error.([A-Za-z.]*)/
+ if dbus_error.name =~ /org.freedesktop.DBus.Error.([A-Za-z.]*)/
case $1
when "ServiceUnknown"
return ServiceNotAvailable.new('PackageKit')
@@ -99,6 +99,30 @@
end
public
+
+ #
+ # PackageKit.lock
+ #
+ # Lock PackagKit for single use
+ #
+ def self.lock
+ Rails.logger.info "PackageKit locking via DBUS lock"
+ YastService.lock # Only one thread have access to DBUS.
+ # So we have to synchronize with YastService calls
+ # Otherwise DBUS hangs
+ Rails.logger.info "PackageKit locked"
+ end
+
+ #
+ # PackageKit.unlock
+ #
+ # Unlock PackagKit
+ #
+ def self.unlock
+ YastService.unlock
+ Rails.logger.info "PackageKit unlocked via DBUS unlock"
+ end
+
#
# PackageKit.connect
#
@@ -160,15 +184,15 @@
#
def self.transact(method, args, signal = nil, bg_stat = nil, &block)
begin
+ error = ''
+ result = nil
transaction_iface, packagekit_iface = self.connect
proxy = transaction_iface.object
- error = ''
-
# set the custom signal handler if set
proxy.on_signal(signal.to_s, &block) if !signal.blank? && block_given?
-
+ proxy.on_signal("Error") { dbusloop.quit }
if bg_stat
proxy.on_signal("StatusChanged") do |s|
Rails.logger.debug "PackageKit progress: StatusChanged: #{s}"
@@ -182,17 +206,13 @@
bg_stat.subprogress = p2 < 101 ? p2 : -1
end
end
-
dbusloop = self.dbusloop proxy, error
-
dbusloop << proxy.bus
-
# Do the call only when all signal handlers are in place,
# otherwise Finished can arrive early and dbusloop will never
# quit, bnc#561578
# call it after creating the DBus loop (bnc#579001)
result = transaction_iface.send(method.to_sym, *args)
-
# run the main loop, process the incoming signals
dbusloop.run
@@ -203,8 +223,7 @@
proxy.on_signal("StatusChanged")
end
proxy.on_signal(signal.to_s) if !signal.blank? && block_given?
-
- packagekit_iface.SuggestDaemonQuit
+ proxy.on_signal("Error")
raise PackageKitError.new(error) unless error.blank?
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/scripts/install_patches.rb new/www/scripts/install_patches.rb
--- old/www/scripts/install_patches.rb 2010-12-13 11:21:27.000000000 +0100
+++ new/www/scripts/install_patches.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,77 +0,0 @@
-#--
-# Copyright (c) 2009-2010 Novell, Inc.
-#
-# All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, contact Novell, Inc.
-#
-# To contact Novell about this file by physical or electronic mail,
-# you may find current contact information at www.novell.com
-#++
-
-
-# this is a helper script
-#
-# ruby-dbus is NOT thread safe and therefore patches cannot be safely read
-# in a separate thread, workaround is to use a separate process (this script)
-
-# this is an observer class which prints changes in the progress
-# in XML format on stdout
-class ProgressPrinter
- def initialize(prog)
- # watch changes in a progress status object
- prog.add_observer(self)
- end
-
- # this is the callback method
- def update(progress)
- # print the progress in XML format on single line
- puts progress.to_xml.gsub("\n", '')
-
- # print it immediately, flush the output buffer
- $stdout.flush
- end
-end
-
-bs = BackgroundStatus.new
-
-# register a progress printer for the progress object
-ProgressPrinter.new(bs)
-
-pk_id = ARGV[0]
-
-begin
- result = Patch.do_install(pk_id, ['RequireRestart','Message']) { |type, details|
- Rails.logger.info "** Background process: Message signal received: #{type}, #{details}"
- begin
- dirname = File.dirname(Patch::MESSAGES_FILE)
- FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
- f = File.new(Patch::MESSAGES_FILE, 'a+')
- f.puts '<br/>' unless File.size(Patch::MESSAGES_FILE).zero?
- # TODO: make the message traslatable
- f.puts "#{details}"
- rescue Exception => e
- Rails.logger.error "writing #{Patch::MESSAGES_FILE} file failed: #{e.try(:message)}"
- ensure
- f.try(:close)
- end
- }
-
- puts ({'result' => result}).to_xml(:root => "patch_installation", :dasherize => false).gsub("\n", '')
-rescue Exception => e
- if e.respond_to? :to_xml
- puts e.to_xml.gsub("\n", '')
- else
- puts PackageKitError.new(e.message).to_xml.gsub("\n", '')
- end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/scripts/list_patches.rb new/www/scripts/list_patches.rb
--- old/www/scripts/list_patches.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/scripts/list_patches.rb 1970-01-01 01:00:00.000000000 +0100
@@ -1,62 +0,0 @@
-#--
-# Copyright (c) 2009-2010 Novell, Inc.
-#
-# All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License
-# as published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, contact Novell, Inc.
-#
-# To contact Novell about this file by physical or electronic mail,
-# you may find current contact information at www.novell.com
-#++
-
-
-# this is a helper script
-#
-# ruby-dbus is NOT thread safe and therefore patches cannot be safely read
-# in a separate thread, workaround is to use a separate process (this script)
-
-# this an observer class which prints changes in the progress
-# in XML format on stdout
-class ProgressPrinter
- def initialize(prog)
- # watch changes in a progress status object
- prog.add_observer(self)
- end
-
- # this is the callback method
- def update(progress)
- # print the progress in XML format on single line
- puts progress.to_xml.gsub("\n", '')
-
- # print it immediately, flush the output buffer
- $stdout.flush
- end
-end
-
-bs = BackgroundStatus.new
-
-# register a progress printer for the progress object
-ProgressPrinter.new(bs)
-
-what = :available
-
-begin
- patches = Patch.do_find(what, bs)
- puts patches.to_xml(:root => "patches", :dasherize => false).gsub("\n", '')
-rescue Exception => e
- if e.respond_to? :to_xml
- puts e.to_xml.gsub("\n", '')
- else
- puts PackageKitError.new(e.message).to_xml.gsub("\n", '')
- end
-end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/test/functional/patches_controller_test.rb new/www/test/functional/patches_controller_test.rb
--- old/www/test/functional/patches_controller_test.rb 2010-12-13 11:21:27.000000000 +0100
+++ new/www/test/functional/patches_controller_test.rb 2011-04-20 13:07:36.000000000 +0200
@@ -51,7 +51,7 @@
:repo => "openSUSE-11.1-Updates")
Patch.stubs(:mtime).returns(Time.now)
- Patch.stubs(:find).with(:available, {:background => nil}).returns([@p1, @p2])
+ Patch.stubs(:find).with(:all).returns([@p1, @p2])
Patch.stubs(:find).with('462').returns(@p1)
Patch.stubs(:find).with('wrong_id').returns(nil)
Patch.stubs(:find).with('not_found').returns(nil)
@@ -137,4 +137,12 @@
assert Hash.from_xml((a)response.body)["messages"].empty?
end
+ test "license required" do
+ PatchesState.stubs(:read).returns(:message_id => "PATCH_EULA").once
+
+ get :index
+ assert_response 503
+ assert_equal "PACKAGEKIT_LICENSE", Hash.from_xml((a)response.body)["error"]["type"]
+ end
+
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/test/functional/repositories_controller_test.rb new/www/test/functional/repositories_controller_test.rb
--- old/www/test/functional/repositories_controller_test.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/test/functional/repositories_controller_test.rb 2011-04-11 12:49:05.000000000 +0200
@@ -219,58 +219,6 @@
assert_response :missing
end
- # Test cache expiration
- test "cache expired" do
- cached = Time.utc(2010,"jan",1,20,0,0) #=> Fri Jan 01 20:00:00 UTC 2010
- modified = cached + 60 # modified 1 minute after caching
- current_time = modified + 60 # now it's 1 minute after the modification
- Time.stubs(:now).returns(current_time)
-
- Rails.cache.expects(:read).with(RepositoriesController::CACHE_ID).returns(cached)
- Repository.expects(:mtime).returns(modified)
-
- # check that the actions are expired
- @controller.expects(:expire_action).with(:action => :index, :format => nil)
-
- Rails.cache.expects(:write).with(RepositoriesController::CACHE_ID, current_time)
-
- get :index
- end
-
- test "cache still valid" do
- cached = Time.utc(2010,"jan",1,20,0,0) #=> Fri Jan 01 20:00:00 UTC 2010
- modified = cached - 60 # modified 1 minute before caching
- current_time = cached + 60 # now it's 1 minute after caching the first call
- Time.stubs(:now).returns(current_time)
-
- Rails.cache.expects(:read).with(RepositoriesController::CACHE_ID).returns(cached)
- Repository.expects(:mtime).returns(modified)
-
- # check that the actions are not expired
- @controller.expects(:expire_action).never
- # do not update the cache time stamp
- Rails.cache.expects(:write).never
-
- get :index
- end
-
- test "not cached yet" do
- cached = nil # not cached yet
- modified = Time.utc(2010,"jan",1,20,0,0) #=> Fri Jan 01 20:00:00 UTC 2010
- current_time = modified + 60 # now it's 1 minute after the modification
- Time.stubs(:now).returns(current_time)
-
- Rails.cache.expects(:read).with(RepositoriesController::CACHE_ID).returns(cached)
-
- # check that the actions are not expired
- @controller.expects(:expire_action).never
-
- # just update the cache time stamp
- Rails.cache.expects(:write).with(RepositoriesController::CACHE_ID, current_time)
-
- get :index
- end
-
# Test validations
test "create with invalid priority" do
Repository.any_instance.expects(:update).never
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/test/unit/packagekit_test.rb new/www/test/unit/packagekit_test.rb
--- old/www/test/unit/packagekit_test.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/test/unit/packagekit_test.rb 2011-04-11 12:49:05.000000000 +0200
@@ -59,7 +59,7 @@
def test_install
@transaction.stubs(:UpdatePackages).returns(true)
- result = Patch.install :id1
+ result = Patch.install "id1"
assert result
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/www/test/unit/patch_test.rb new/www/test/unit/patch_test.rb
--- old/www/test/unit/patch_test.rb 2010-08-27 14:58:55.000000000 +0200
+++ new/www/test/unit/patch_test.rb 2011-04-11 12:49:05.000000000 +0200
@@ -93,39 +93,6 @@
assert_equal [], patch
end
- SCRIPT_OUTPUT_ERROR = read_test_data('patch_test-script_error.out')
-
- def test_available_patches_background_mode_error
-
- Patch.stubs(:read_subprocess).returns(*SCRIPT_OUTPUT_ERROR)
- # return EOF when all lines are read
- Patch.stubs(:eof_subprocess?).returns(*(Array.new(SCRIPT_OUTPUT_ERROR.size, false) << true))
-
- # note: Patch.find(:available, {:background => true})
- # cannot be used here, Threading support in test mode doesn't work :-(
- patches = Patch.subprocess_find(:available)
-
- assert_equal PackageKitError, patches.class
- end
-
- SCRIPT_OUTPUT_OK = read_test_data('patch_test-script_ok.out')
-
- def test_available_patches_background_mode_ok
- Patch.stubs(:read_subprocess).returns(*SCRIPT_OUTPUT_OK)
-
- # return EOF when all lines are read
- Patch.stubs(:eof_subprocess?).returns(*(Array.new(SCRIPT_OUTPUT_OK.size, false) << true))
-
- # note: Patch.find(:available, {:background => true})
- # cannot be used here, Threading support in test mode doesn't work :-(
- patches = Patch.subprocess_find(:available)
-
- assert_equal 4, patches.size
- assert_equal 1579, patches.first.resolvable_id
- assert_equal 'slessp0-openslp', patches.first.name
- end
-
-
def test_patch_install
rset = PackageKitResultSet.new "Package", :info => :s, :id => :s, :summary => :s
rset << [ 'important', 'update-test-affects-package-manager;847;noarch;updates-test', 'update-test: Test updates for 11.2' ]
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: opensuse-commit+help(a)opensuse.org
1
0