Hello community, here is the log from the commit of package hawk2 for openSUSE:Factory checked in at 2016-04-01 13:02:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/hawk2 (Old) and /work/SRC/openSUSE:Factory/.hawk2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "hawk2" Changes: -------- --- /work/SRC/openSUSE:Factory/hawk2/hawk2.changes 2016-03-26 15:24:55.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.hawk2.new/hawk2.changes 2016-04-01 13:03:06.000000000 +0200 @@ -1,0 +2,11 @@ +Thu Mar 31 05:22:46 UTC 2016 - kgronl...@suse.com + +- Update to version 2.0.0+git.1459374052.159281a: + + Cib: Save fence history in node data (bsc#968055) + + Wizard: Need admin rights if non-local call + + UI: Status: Display constraints for resource + + UI: Status: Display migration status for resources + + UI: Status: Make remote node indicator a small icon + + Remove use of Hashie + +------------------------------------------------------------------- Old: ---- hawk2-2.0.0+git.1458543074.dc9aa66.tar.bz2 New: ---- hawk2-2.0.0+git.1459374052.159281a.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hawk2.spec ++++++ --- /var/tmp/diff_new_pack.8P4Rdl/_old 2016-04-01 13:03:07.000000000 +0200 +++ /var/tmp/diff_new_pack.8P4Rdl/_new 2016-04-01 13:03:07.000000000 +0200 @@ -31,11 +31,13 @@ %define gname haclient %define uname hacluster +%define version_unconverted 2.0.0+git.1459374052.159281a + Name: hawk2 Summary: HA Web Konsole License: GPL-2.0 Group: %{pkg_group} -Version: 2.0.0+git.1458543074.dc9aa66 +Version: 2.0.0+git.1459374052.159281a Release: 0 Url: http://www.clusterlabs.org/wiki/Hawk Source: %{name}-%{version}.tar.bz2 @@ -76,7 +78,6 @@ BuildRequires: rubygem(%{rb_default_ruby_abi}:gettext_i18n_rails:1) >= 1.2 BuildRequires: rubygem(%{rb_default_ruby_abi}:gettext_i18n_rails_js) >= 1.0 BuildRequires: rubygem(%{rb_default_ruby_abi}:haml-rails) >= 0.8.2 -BuildRequires: rubygem(%{rb_default_ruby_abi}:hashie) >= 3.4 BuildRequires: rubygem(%{rb_default_ruby_abi}:js-routes:1) BuildRequires: rubygem(%{rb_default_ruby_abi}:kramdown:1) >= 1.3 BuildRequires: rubygem(%{rb_default_ruby_abi}:mail) >= 2.6 @@ -110,7 +111,6 @@ Requires: rubygem(%{rb_default_ruby_abi}:gettext_i18n_rails:1) >= 1.2 Requires: rubygem(%{rb_default_ruby_abi}:gettext_i18n_rails_js) >= 1.0 Requires: rubygem(%{rb_default_ruby_abi}:haml-rails) >= 0.8.2 -Requires: rubygem(%{rb_default_ruby_abi}:hashie) >= 3.4 Requires: rubygem(%{rb_default_ruby_abi}:js-routes:1) Requires: rubygem(%{rb_default_ruby_abi}:kramdown:1) >= 1.3 Requires: rubygem(%{rb_default_ruby_abi}:puma) >= 2.11 ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.8P4Rdl/_old 2016-04-01 13:03:07.000000000 +0200 +++ /var/tmp/diff_new_pack.8P4Rdl/_new 2016-04-01 13:03:07.000000000 +0200 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">git://github.com/ClusterLabs/hawk.git</param> - <param name="changesrevision">dc9aa660b415aeff726ac9f3dcac441c8fdc7281</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">159281ac28491b758b46e3f492d3990423aa8953</param></service></servicedata> \ No newline at end of file ++++++ hawk2-2.0.0+git.1458543074.dc9aa66.tar.bz2 -> hawk2-2.0.0+git.1459374052.159281a.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/Makefile new/hawk2-2.0.0+git.1459374052.159281a/Makefile --- old/hawk2-2.0.0+git.1458543074.dc9aa66/Makefile 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/Makefile 2016-03-31 07:22:40.000000000 +0200 @@ -50,7 +50,7 @@ (cd hawk; \ if $(BUNDLE_GEMS) ; then \ # Ignore gems from test \ - export BUNDLE_WITHOUT=test && \ + export BUNDLE_WITHOUT="test" && \ # Generate Gemfile.lock \ bundle list && \ # Strip unwanted gems from Gemfile.lock \ @@ -59,7 +59,7 @@ bundle package && bundle install --local --deployment ; \ fi ; \ TEXTDOMAIN=hawk bin/rake gettext:pack; \ - RAILS_ENV=production bin/rake assets:precompile) + RAILS_ENV=production bundle exec rake assets:precompile) %:: %.in sed \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/TODO.md new/hawk2-2.0.0+git.1459374052.159281a/TODO.md --- old/hawk2-2.0.0+git.1458543074.dc9aa66/TODO.md 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/TODO.md 2016-03-31 07:22:40.000000000 +0200 @@ -2,12 +2,6 @@ * Controls for all resources: stop all, start all, ... ? -* Show fencing history for each node: - - stonith_admin -H <node> - -* Indicate when there is fencing history for a node - * Display allocation scores and blocked status * Show if a resource has failcounts diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/Gemfile new/hawk2-2.0.0+git.1459374052.159281a/hawk/Gemfile --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/Gemfile 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/Gemfile 2016-03-31 07:22:40.000000000 +0200 @@ -17,7 +17,6 @@ gem "rails", "~> 4.2.0" gem "puma", ">= 2.11" gem "sass-rails", "~> 5.0.1" -gem "hashie", "~> 3.4.0" gem "virtus", "~> 1.0.4" gem "js-routes", "~> 1.0" gem "tilt", "~> 1.4.1" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/assets/javascripts/module/nodes.js new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/assets/javascripts/module/nodes.js --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/assets/javascripts/module/nodes.js 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/assets/javascripts/module/nodes.js 2016-03-31 07:22:40.000000000 +0200 @@ -66,7 +66,11 @@ var ret = ['<i class="', icon.join(' '), '" title="', title, '"></i>']; if (row.remote) { - ret.push(' <i class="fa fa-cloud text-info" title="', __("Remote"), '"></i>'); + ret.push(' <i class="fa fa-cloud fa-status-small text-info" title="', __("Remote"), '"></i>'); + } + + if (row.fence_history) { + ret.push(' <i class="fa fa-refresh fa-status-small text-warning" title="', row.fence_history, '"></i>'); } return ret.join(''); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/assets/javascripts/module/resources.js new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/assets/javascripts/module/resources.js --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/assets/javascripts/module/resources.js 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/assets/javascripts/module/resources.js 2016-03-31 07:22:40.000000000 +0200 @@ -186,6 +186,23 @@ return { edit: editRoute, destroy: destroyRoute }; } + function startswith(str, prefix) { + return str.substr(0, prefix.length) === prefix; + } + + function resourceMigrationConstraints(rsc) { + var cib = $('body').data('content'); + var ban = "cli-ban-" + rsc + "-on-"; + var prefer = "cli-prefer-" + rsc; + var ret = []; + $.each(cib.constraints, function(i, c) { + if (c.id == prefer || startswith(c.id, ban)) { + ret.push(c.id); + } + }); + return ret; + } + var statesResourcesColumns = [ { field: 'state', @@ -196,44 +213,31 @@ halign: "center", class: 'col-sm-1', formatter: function(value, row, index) { + var fmt = []; switch(value) { - case "unmanaged": - return [ - '<i class="fa fa-exclamation-triangle fa-lg text-warning" title="', - __("Unmanaged"), - '"></i>' - ].join(''); - case "started": - return [ - '<i class="fa fa-circle fa-lg text-success" title="', - __("Started"), - '"></i>' - ].join(''); - case "master": - return [ - '<i class="fa fa-circle fa-lg text-info" title="', - __("Primary"), - '"></i>' - ].join(''); - case "slave": - return [ - '<i class="fa fa-dot-circle-o fa-lg text-success" title="', - __("Secondary"), - '"></i>' - ].join(''); - case "stopped": - return [ - '<i class="fa fa-minus-circle fa-lg text-danger" title="', - __("Stopped"), - '"></i>' - ].join(''); - default: - return [ - '<i class="fa fa-question fa-lg text-warning" title="', - value, - '"></i>' - ].join(''); - } + case "unmanaged": + fmt.push('<i class="fa fa-exclamation-triangle fa-lg text-warning" title="', __("Unmanaged"), '"></i>'); + break; + case "started": + fmt.push('<i class="fa fa-circle fa-lg text-success" title="', __("Started"), '"></i>'); + break; + case "master": + fmt.push('<i class="fa fa-circle fa-lg text-info" title="', __("Primary"), '"></i>'); + break; + case "slave": + fmt.push('<i class="fa fa-dot-circle-o fa-lg text-success" title="', __("Secondary"), '"></i>'); + break; + case "stopped": + fmt.push('<i class="fa fa-minus-circle fa-lg text-danger" title="', __("Stopped"), '"></i>'); + break; + default: + fmt.push('<i class="fa fa-question fa-lg text-warning" title="', value, '"></i>'); + break; + } + $.each(resourceMigrationConstraints(row.id), function(i, c) { + fmt.push('<i class="fa fa-link fa-status-small text-info" title="', c, '"></i>'); + }); + return fmt.join(""); } }, { @@ -399,8 +403,11 @@ var rsc_routes = resourceRoutes(row); - add_operation("menu", Routes.migrate_cib_resource_path($('body').data('cib'), row.id), 'migrate', 'hand-o-up', __('Migrate')); - add_operation("menu", Routes.unmigrate_cib_resource_path($('body').data('cib'), row.id), 'unmigrate', 'hand-o-down', __('Unmigrate')); + if (resourceMigrationConstraints(row.id).length > 0) { + add_operation("menu", Routes.unmigrate_cib_resource_path($('body').data('cib'), row.id), 'unmigrate', 'chain-broken', __('Unmigrate')); + } else { + add_operation("menu", Routes.migrate_cib_resource_path($('body').data('cib'), row.id), 'migrate', 'arrows', __('Migrate')); + } add_operation("menu", Routes.cleanup_cib_resource_path($('body').data('cib'), row.id), 'cleanup', 'eraser', __('Cleanup')); if (row.object_type == "tag") { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/assets/stylesheets/shared/_misc.scss new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/assets/stylesheets/shared/_misc.scss --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/assets/stylesheets/shared/_misc.scss 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/assets/stylesheets/shared/_misc.scss 2016-03-31 07:22:40.000000000 +0200 @@ -59,3 +59,8 @@ .diff_next { background-color: #c0c0c0; } + +.fa-status-small { + font-size: 66%; + vertical-align: top; +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/application_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/application_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/application_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/application_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -218,19 +218,24 @@ end def footer_metadata_items + meta_items = [ + [_("Status"), "meta.status", :status, nil], + [_("Epoch"), "meta.epoch", :epoch, _("Current Configuration Version")], + [_("Host"), "meta.host", :host, nil], + [_("DC"), "meta.dc", :dc, _("Designated Coordinator")], + [_("Schema"), "meta.validate_with", :validate_with, _("CIB Schema Version")], + [_("Last Written"), "meta.cib_last_written", :cib_last_written], + [_("Update Origin"), "meta.update_origin", :update_origin], + [_("Update User"), "meta.update_user", :update_user], + [_("Have Quorum"), "meta.have_quorum", :have_quorum], + [_("Version"), "meta.version", :version, _("Pacemaker Version")], + [_("Stack"), "meta.stack", :stack, _("Cluster Communication Stack")] + ] meta = current_cib.meta - [].tap do |ret| - ret.push [_("Status"), "meta.status", meta.status, nil] - ret.push [_("Epoch"), "meta.epoch", meta.epoch, _("Current Configuration Version")] - ret.push [_("Host"), "meta.host", meta.host, nil] - ret.push [_("DC"), "meta.dc", meta.dc, _("Designated Coordinator")] - ret.push [_("Schema"), "meta.validate_with", meta.validate_with, _("CIB Schema Version")] if meta.validate_with? - ret.push [_("Last Written"), "meta.cib_last_written", meta.cib_last_written] if meta.cib_last_written? - ret.push [_("Update Origin"), "meta.update_origin", meta.update_origin] if meta.update_origin? - ret.push [_("Update User"), "meta.update_user", meta.update_user] if meta.update_user? - ret.push [_("Have Quorum"), "meta.have_quorum", meta.have_quorum] if meta.have_quorum? - ret.push [_("Version"), "meta.version", meta.version, _("Pacemaker Version")] - ret.push [_("Stack"), "meta.stack", meta.stack, _("Cluster Communication Stack")] + ret = [] + meta_items.each do |item| + ret.push [item[0], item[1], meta[item[2]], item[3]] if meta.key? item[2] end + ret end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/clone_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/clone_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/clone_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/clone_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -5,7 +5,7 @@ def clone_child_list @cib.resources.select do |r| !r.key?(:children) || (r.key?(:children) && r[:type] == "group") - end.map(&:id).sort do |a, b| + end.map{|x| x[:id]}.sort do |a, b| a.natcmp(b, true) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/colocation_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/colocation_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/colocation_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/colocation_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -13,8 +13,8 @@ def available_colocation_resources [ - @cib.resources.map(&:id), - @cib.templates.map(&:id) + @cib.resources.map{|x| x[:id]}, + @cib.templates.map{|x| x[:id]} ].flatten.sort do |a, b| a.natcmp(b, true) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/group_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/group_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/group_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/group_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -3,7 +3,7 @@ module GroupHelper def group_children_list - @cib.resources.select { |r| !r.key?(:children) }.map(&:id).sort { |a, b| a.natcmp(b, true) } + @cib.resources.select { |r| !r.key?(:children) }.map { |x| x[:id] }.sort { |a, b| a.natcmp(b, true) } end def group_children_for(group) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/location_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/location_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/location_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/location_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -4,7 +4,7 @@ module LocationHelper def location_resource_options(selected) available = [ - @cib.resources.map(&:id) + @cib.resources.map{|x| x[:id]} ].flatten.uniq.sort do |a, b| a.natcmp(b, true) end @@ -17,7 +17,7 @@ def location_node_options(selected) available = [ - @cib.nodes.map(&:id) + @cib.nodes.map{|x| x[:id]} ].flatten.uniq.sort do |a, b| a.natcmp(b, true) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/master_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/master_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/master_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/master_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -3,9 +3,9 @@ module MasterHelper def master_child_list - options = @cib.resources.select do |r| + @cib.resources.select do |r| !r.key?(:children) || (r.key?(:children) && r[:type] == "group") - end.map(&:id).sort do |a, b| + end.map{|x| x[:id]}.sort do |a, b| a.natcmp(b, true) end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/order_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/order_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/order_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/order_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -13,8 +13,8 @@ def available_order_resources [ - @cib.resources.map(&:id), - @cib.templates.map(&:id) + @cib.resources.map{|x| x[:id]}, + @cib.templates.map{|x| x[:id]} ].flatten.sort do |a, b| a.natcmp(b, true) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/role_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/role_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/role_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/role_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -4,7 +4,7 @@ module RoleHelper def role_options(selected) options_for_select( - Role.ordered.map(&:id), + Role.ordered.map{|x| x[:id]}, selected ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/ticket_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/ticket_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/ticket_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/ticket_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -25,8 +25,8 @@ def available_ticket_resources [ - @cib.resources.map(&:id), - @cib.templates.map(&:id) + @cib.resources.map{|x| x[:id]}, + @cib.templates.map{|x| x[:id]} ].flatten.sort do |a, b| a.natcmp(b, true) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/user_helper.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/user_helper.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/helpers/user_helper.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/helpers/user_helper.rb 2016-03-31 07:22:40.000000000 +0200 @@ -4,7 +4,7 @@ module UserHelper def user_options(selected) options_for_select( - User.ordered.map(&:id), + User.ordered.map{|x| x[:id]}, selected ) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/cib.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/cib.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/cib.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/cib.rb 2016-03-31 07:22:40.000000000 +0200 @@ -72,21 +72,21 @@ def meta @meta ||= begin - struct = Hashie::Mash.new + struct = {} @xml.root.attributes.each do |n, v| struct[n.underscore.to_sym] = Util.unstring(v, '') end unless @xml.nil? - struct.epoch = epoch - struct.dc = dc + struct[:epoch] = epoch + struct[:dc] = dc - struct.host = Socket.gethostname + struct[:host] = Socket.gethostname - struct.version = crm_config[:dc_version] - struct.stack = crm_config[:cluster_infrastructure] + struct[:version] = crm_config[:dc_version] + struct[:stack] = crm_config[:cluster_infrastructure] - struct.status = case + struct[:status] = case when errors.empty? # TODO(must): Add stopped checks @@ -119,18 +119,16 @@ end def offline? - meta.status == :offline + meta[:status] == :offline end def node_state_of_resource(rsc) nodestate = {} rsc[:instances].each do |_, attrs| [:master, :slave, :started, :failed, :pending].each do |rstate| - if attrs[rstate] - attrs[rstate].each do |n| - nodestate[n[:node]] = rstate - end - end + attrs[rstate].each do |n| + nodestate[n[:node]] = rstate + end if attrs[rstate] end end if rsc.key? :instances rsc[:children].each do |child| @@ -141,7 +139,7 @@ def status(minimal = false) { - meta: meta.to_h, + meta: meta, errors: errors, booth: booth }.tap do |result| @@ -260,13 +258,13 @@ protected def get_resource(elem, is_managed = true, clone_max = nil, is_ms = false) - res = Hashie::Mash.new( + res = { id: elem.attributes['id'], object_type: elem.name, attributes: {}, is_managed: is_managed, state: :unknown - ) + } @resources_by_id[elem.attributes['id']] = res elem.elements.each("meta_attributes/nvpair/") do |nv| res[:attributes][nv.attributes["name"]] = nv.attributes["value"] @@ -331,10 +329,10 @@ res[:instances].delete(:default) instance = 0 while res[:instances].length < res[:clone_max] - while res[:instances].key?(instance.to_s) + while res[:instances].key?(instance.to_s.to_sym) instance += 1 end - res[:instances][instance.to_s] = { + res[:instances][instance.to_s.to_sym] = { failed_ops: [], is_managed: res[:is_managed] && !@crm_config[:maintenance_mode] } @@ -343,7 +341,7 @@ # strip any instances outside 0..clone_max if they're not running (these # can be present if, e.g.: you have a clone running on all nodes, then # set clone-max < num_nodes, in which case there'll be stopped orphans). - res[:instances].keys.select{|i| i.to_i >= res[:clone_max]}.each do |k| + res[:instances].keys.select{|i| i.to_s.to_i >= res[:clone_max]}.each do |k| # safe to delete if the instance is present and its only state is stopped res[:instances].delete(k) if res[:instances][k].keys.length == 1 && res[:instances][k].key?(:stopped) end @@ -352,7 +350,7 @@ if res.key?(:instances) res[:instances].delete_if do |k, v| - k.to_s != "default" + k != :default end # Inject a default instance if there's not one, as can be the case when # working with shadow CIBs. @@ -386,7 +384,7 @@ resource[:state] = :stopped if resource[:state] == :unknown resource[:instances].each do |_, states| prio.keys.each do |rstate| - if states.key? rstate.to_s + if states.key? rstate p1 = prio[rstate] p2 = prio[resource[:state]] resource[:state] = rstate if p1 > p2 @@ -545,13 +543,13 @@ @id = id # Special-case defaults for properties we always want to see - @crm_config = Hashie::Mash.new( + @crm_config = { cluster_infrastructure: _('Unknown'), dc_version: _('Unknown'), stonith_enabled: true, symmetric_cluster: true, no_quorum_policy: 'stop', - ) + } # Pull in everything else # TODO(should): This gloms together all cluster property sets; really @@ -560,12 +558,12 @@ @crm_config[p.attributes['name'].underscore.to_sym] = CibTools.get_xml_attr(p, 'value') end - @rsc_defaults = Hashie::Mash.new + @rsc_defaults = {} @xml.elements.each('cib/configuration/rsc_defaults//nvpair') do |p| @rsc_defaults[p.attributes['name'].underscore.to_sym] = CibTools.get_xml_attr(p, 'value') end - @op_defaults = Hashie::Mash.new + @op_defaults = {} @xml.elements.each('cib/configuration/op_defaults//nvpair') do |p| @op_defaults[p.attributes['name'].underscore.to_sym] = CibTools.get_xml_attr(p, 'value') end @@ -603,15 +601,24 @@ if standby and state == :online state = :standby end - @nodes << Hashie::Mash.new( + + # check stonith history + if crm_config[:stonith_enabled] + fence_history = %x[/usr/sbin/stonith_admin -H #{uname} 2>/dev/null].strip + else + fence_history = "" + end + + @nodes << { name: uname || id, uname: uname, state: state, id: node_id, standby: standby, maintenance: maintenance, - remote: remote - ) + remote: remote, + fence_history: fence_history + } if state == :unclean error _('Node "%{node}" is UNCLEAN and needs to be fenced.') % { node: uname } end @@ -626,14 +633,14 @@ state = :unknown standby = false unless @nodes.any? { |nod| nod[:id] == node_id } - @nodes << Hashie::Mash.new( + @nodes << { uname: uname, state: state, id: node_id, standby: standby, maintenance: maintenance, remote: true - ) + } end end @@ -649,12 +656,12 @@ # have state we care about. @templates = [] @xml.elements.each('cib/configuration/resources/template') do |t| - @templates << Hashie::Mash.new( + @templates << { id: t.attributes['id'], class: t.attributes['class'], provider: t.attributes['provider'], type: t.attributes['type'] - ) + } end if Util.has_feature?(:rsc_template) # TODO(must): fix me @@ -665,14 +672,14 @@ @tags = [] @xml.elements.each('cib/configuration/tags/tag') do |t| - @tags << Hashie::Mash.new( + @tags << { id: t.attributes['id'], state: :unknown, object_type: :tag, is_managed: false, running_on: {}, refs: t.elements.collect('obj_ref') { |ref| ref.attributes['id'] } - ) + } end # Iterate nodes in cib order here which makes the faked up clone & ms instance @@ -955,7 +962,7 @@ end end - @booth = Hashie::Mash.new(sites: [], arbitrators: [], tickets: [], me: nil) + @booth = {sites: [], arbitrators: [], tickets: [], me: nil} # Figure out if we're in a geo cluster File.readlines("/etc/booth/booth.conf").each do |line| m = line.match(/^\s*(site|arbitrator|ticket)\s*=(.+)/) @@ -1026,19 +1033,19 @@ def init_offline_cluster(id, user, use_file) @id = id - @meta = Hashie::Mash.new( + @meta = { epoch: "", dc: "", host: "", version: "", stack: "", status: :offline - ) + } - @crm_config = Hashie::Mash.new( + @crm_config = { cluster_infrastructure: _('Unknown'), dc_version: _('Unknown') - ) + } @nodes = [] @resources = [] @resources_by_id = {} @@ -1091,6 +1098,8 @@ instance = :default end + instance = instance.to_sym + # Carry is_managed into the instance itself (needed so we can correctly # display unmanaged clone instances if a single node is on maintenance, # but only do this on first initialization else state may get screwed diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/node.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/node.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/node.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/node.rb 2016-03-31 07:22:40.000000000 +0200 @@ -19,6 +19,7 @@ attribute :remote, Boolean attribute :maintenance, Boolean attribute :fence, Boolean + attribute :fence_history, String validates :id, presence: { message: _('Node ID is required') }, @@ -145,6 +146,7 @@ record.standby = state[:standby] record.maintenance = state[:maintenance] record.remote = state[:remote] + record.fence_history = state[:fence_history] record.fence = can_fence record.params = if xml.elements['instance_attributes'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/resource.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/resource.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/resource.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/resource.rb 2016-03-31 07:22:40.000000000 +0200 @@ -138,6 +138,25 @@ @id = "#{other}-#{i}" end + def rsc_constraints + outp = %x[/usr/sbin/crm_resource --resource "#{id}" -A 2>/dev/null] + info = {} + outp.each_line do |l| + l.strip! + next if l.blank? || l.start_with?('* ') + m = l.match(/\s*: Node (\S+)\s+\(score=([^,]+), id=([^)]+)\)/) + if m && !info.key?(m[3]) + info[m[3]] = { id: m[3], type: :location, score: m[2], other: m[1] } + else + m = l.match(/\s*(\S+)\s+\(score=([^,]+), id=([^)]+)\)/) + if m && !info.key?(m[3]) + info[m[3]] = { id: m[3], type: :colocation, score: m[2], other: m[1] } + end + end + end + info.values + end + protected def cib_by_id(id) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/wizard.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/wizard.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/models/wizard.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/models/wizard.rb 2016-03-31 07:22:40.000000000 +0200 @@ -74,7 +74,9 @@ t = (action['text'] || '').split.first || '' return false if ['configure', 'resource', 'cib'].any? { |c| c == t } end - return false if action['name'] == 'call' && action['sudo'].nil? + if action['name'] == 'call' && action['sudo'].nil? && action['nodes'] == 'local' + return false + end true end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/views/cib/show.html.haml new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/views/cib/show.html.haml --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/views/cib/show.html.haml 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/views/cib/show.html.haml 2016-03-31 07:22:40.000000000 +0200 @@ -1,8 +1,8 @@ .container-fluid .row .pull-left - .circle.circle-medium{ class: status_class_for(@cib.meta.status) } - = status_icon_for(@cib.meta.status) + .circle.circle-medium{ class: status_class_for(@cib.meta[:status]) } + = status_icon_for(@cib.meta[:status]) %h1 = _("Status") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/views/nodes/show.html.haml new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/views/nodes/show.html.haml --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/views/nodes/show.html.haml 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/views/nodes/show.html.haml 2016-03-31 07:22:40.000000000 +0200 @@ -13,6 +13,9 @@ - if @node.remote .alert.alert-info{role: :alert} = _("Remote node.") + - unless @node.fence_history.blank? + .alert.alert-warning{role: :warning} + = @node.fence_history %table.table.table-condensed %tbody diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/views/resources/show.html.haml new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/views/resources/show.html.haml --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/app/views/resources/show.html.haml 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/app/views/resources/show.html.haml 2016-03-31 07:22:40.000000000 +0200 @@ -134,6 +134,26 @@ %td= content_tag :code, op[:op] %td= content_tag :code, op[:rc_code] %td= content_tag :code, op[:exit_reason] + .panel.panel-default + .panel-heading#r-constraints{role: :tab} + %h4.panel-title + %a{role: :button, data: {toggle: :collapse}, href: "#r-constraints-body", aria: {expanded: true, controls: "r-constraints-body"}} + = _("Constraints") + .pull-right + %span.caret + #r-constraints-body.panel-collapse.collapse.in{role: :tabpanel, aria: {labelledby: "r-constraints"}} + %table.table.table-condensed + %tr + %th= _("ID") + %th= _("Type") + %th= _("Score") + %th= _("To") + - @resource.rsc_constraints.each do |constraint| + %tr + %td= constraint[:id] + %td= constraint[:type] + %td= constraint[:score] + %td= constraint[:other] .modal-footer %button.btn.btn-default{ type: "button", data: { dismiss: "modal" } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/config/application.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/config/application.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/config/application.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/config/application.rb 2016-03-31 07:22:40.000000000 +0200 @@ -36,7 +36,9 @@ config.i18n.enforce_available_locales = false if Rails.env.development? - config.web_console.whitelisted_ips = ["192.168.0.0/16", "10.0.2.2", "10.13.37.0/24"] + if config.respond_to? :web_console + config.web_console.whitelisted_ips = ["192.168.0.0/16", "10.0.2.2", "10.13.37.0/24"] + end else config.middleware.use Rack::Deflater end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/config/environments/production.rb new/hawk2-2.0.0+git.1459374052.159281a/hawk/config/environments/production.rb --- old/hawk2-2.0.0+git.1458543074.dc9aa66/hawk/config/environments/production.rb 2016-03-21 09:18:34.000000000 +0100 +++ new/hawk2-2.0.0+git.1459374052.159281a/hawk/config/environments/production.rb 2016-03-31 07:22:40.000000000 +0200 @@ -33,7 +33,7 @@ config.assets.debug = false config.assets.raise_runtime_errors = false config.assets.js_compressor = :uglifier - config.assets.css_compressor = nil + config.assets.css_compressor = :sass config.assets.compile = true config.assets.digest = true config.assets.manifest = Rails.root.join("public", "assets", "manifest.json")