theforeman / foreman_statistics

Foreman plugin to present statistics and trends
https://theforeman.org/plugins/foreman_statistics/
GNU General Public License v3.0
0 stars 6 forks source link

PG::UndefinedTable: ERROR: relation "trends" does not exist #29

Open fadamo opened 3 years ago

fadamo commented 3 years ago

Hello,

we have migrated Katello 3.7.1 to 3.18 (-> foreman 2.3.2). We were using Trends, so I installed tfm-rubygem-foreman_statistics.

After services' restart the Trends menu got visible but clicking on it appeared an error about old data. So I ran "foreman-rake purge:trends".

Now it seems I don't have the trends table anymore, running foreman_statistics:trends:counter I got:

PG::UndefinedTable: ERROR: relation "trends" does not exist

How can I recreate the missing tables ?

Thanks Bye

ezr-ondrej commented 3 years ago

Hi @fadamo,

That's unfortunate, foreman-rake purge:trends remove all the trends, so you've lost historical data, unless you've got backup of them.

But running foreman-rake db:migrate with plugin installed should recreate the plugin tables and allow you use the plugin again.

Let me know if that works :)

Ondrej

fadamo commented 3 years ago

Hi! Thank you very much.

Now statistics work fine, treads are still ko. This is what I did:

[root@XXXXXXXXXXXX:~]# foreman-rake db:migrate VERBOSE=true --trace Invoke db:migrate (first_time) Invoke db:load_config (first_time) Invoke environment (first_time) Execute environment Execute db:load_config Invoke plugin:refresh_migrations (first_time) Invoke environment Execute plugin:refresh_migrations ** Execute db:migrate == 20121012170851 CreateTrends: migrating

-- create_table(:trends) -> 0.0096s -- add_index(:trends, :type) -> 0.0055s -- add_index(:trends, [:trendable_type, :trendable_id]) -> 0.0042s -- add_index(:trends, :fact_value) -> 0.0033s == 20121012170851 CreateTrends: migrated (0.0230s)

== 20121012170936 CreateTrendCounters: migrating

-- create_table(:trend_counters) -> 0.0078s == 20121012170936 CreateTrendCounters: migrated (0.0079s)

== 20150202094307 AddRangeToTrendCounters: migrating

-- add_column(:trend_counters, :interval_start, :datetime) -> 0.0006s -- add_column(:trend_counters, :interval_end, :datetime) -> 0.0003s == 20150202094307 AddRangeToTrendCounters: migrated (0.0010s)

== 20181031155025 AddTrendCounterCreatedAtUniqueConstraint: migrating

-- add_index(:trend_counters, [:trend_id, :created_at], {:unique=>true}) -> 0.0036s == 20181031155025 AddTrendCounterCreatedAtUniqueConstraint: migrated (0.0036s)

== 20200605153005 MigrateCoreTypes: migrating

== 20200605153005 MigrateCoreTypes: migrated (0.0193s)

Invoke db:_dump (first_time) Execute db:_dump Invoke dynflow:migrate (first_time) Invoke environment ** Execute dynflow:migrate

==> Oops, we're sorry but something went wrong No route matches {:action=>"new", :controller=>"foreman_statistics/trends"}

[root@XXXXXXXXXXXX:~]# foreman-maintain service restart

==> Oops, we're sorry but something went wrong No route matches {:action=>"new", :controller=>"foreman_statistics/trends"}

[root@XXXXXXXXXXXX:~]# foreman-rake apipie:cache:index

==> Oops, we're sorry but something went wrong No route matches {:action=>"new", :controller=>"foreman_statistics/trends"}

Have you got any idea?

Thanks again Best regards

Il giorno ven 26 feb 2021 alle ore 14:08 Ondřej Ezr < notifications@github.com> ha scritto:

Hi @fadamo https://github.com/fadamo,

That's unfortunate, foreman-rake purge:trends remove all the trends, so you've lost historical data, unless you've got backup of them.

But running foreman-rake db:migrate with plugin installed should recreate the plugin tables and allow you use the plugin again.

Let me know if that works :)

Ondrej

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/theforeman/foreman_statistics/issues/29#issuecomment-786637525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKLE3636VVSUUAVLKBZRNXTTA6MLPANCNFSM4YGX5MFA .

2021-02-26T14:32:59 [I|app|ee1a0b01] Started GET "/foreman_statistics/trends" for 127.0.0.1 at 2021-02-26 14:32:59 +0100 2021-02-26T14:32:59 [I|app|ee1a0b01] Processing by ForemanStatistics::TrendsController#index as HTML 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/welcome.html.erb within layouts/application 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/welcome.html.erb within layouts/application (Duration: 2.1ms | Allocations: 1016) 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/index.html.erb within layouts/application 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/index.html.erb within layouts/application (Duration: 1.6ms | Allocations: 827) 2021-02-26T14:32:59 [W|app|ee1a0b01] No route matches {:action=>"new", :controller=>"foreman_statistics/trends"} 2021-02-26T14:32:59 [I|app|ee1a0b01] Backtrace for 'No route matches {:action=>"new", :controller=>"foreman_statistics/trends"}' error (ActionView::Template::Error): No route matches {:action=>"new", :controller=>"foreman_statistics/trends"} ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/formatter.rb:57:in generate' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:738:ingenerate' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:769:in generate' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:816:inurl_for' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/url_for.rb:180:in full_url_for' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/url_for.rb:170:inurl_for' ee1a0b01 | /usr/share/foreman/app/helpers/application_helper.rb:136:in display_link_if_authorized' ee1a0b01 | /usr/share/foreman/app/helpers/application_helper.rb:145:innew_link' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/index.html.erb:3:in _0edc5f16625e7d2fd4898937e238995b' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/base.rb:274:in_run' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/template.rb:185:in block in render' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:182:ininstrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/template.rb:385:in instrument_render_template' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/template.rb:183:inrender' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in render' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/template_renderer.rb:58:inblock (2 levels) in render_template' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/abstract_renderer.rb:88:in block in instrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:inblock in instrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:in instrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:ininstrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/abstract_renderer.rb:87:in instrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/template_renderer.rb:57:inblock in render_template' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/template_renderer.rb:65:in render_with_layout' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/template_renderer.rb:56:inrender_template' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/template_renderer.rb:13:in render' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/renderer.rb:61:inrender_template_to_object' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/renderer/renderer.rb:29:in render_to_object' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/rendering.rb:117:inblock in _render_template' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/base.rb:304:in in_rendering_context' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/rendering.rb:116:in_render_template' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/streaming.rb:218:in _render_template' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/rendering.rb:103:inrender_to_body' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/rendering.rb:52:in render_to_body' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/renderers.rb:142:inrender_to_body' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/rendering.rb:25:in render' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/rendering.rb:36:inrender' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:44:in block (2 levels) in render' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/core_ext/benchmark.rb:14:inblock in ms' ee1a0b01 | /opt/rh/rh-ruby25/root/usr/share/ruby/benchmark.rb:308:in realtime' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/core_ext/benchmark.rb:14:inms' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:44:in block in render' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:84:incleanup_view_runtime' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/railties/controller_runtime.rb:34:in cleanup_view_runtime' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:43:inrender' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/implicit_render.rb:35:in default_render' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:inblock in send_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:in tap' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/basic_implicit_render.rb:6:insend_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb:195:in process_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/rendering.rb:30:inprocess_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/callbacks.rb:42:in block in process_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:112:inblock in run_callbacks' ee1a0b01 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in set_timezone' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:inblock in run_callbacks' ee1a0b01 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in clear_thread' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:inblock in run_callbacks' ee1a0b01 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in set_topbar_sweeper_controller' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:inblock in run_callbacks' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in around' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:inblock in run_callbacks' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in around' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:121:inblock in run_callbacks' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:139:in run_callbacks' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/callbacks.rb:41:inprocess_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/rescue.rb:22:in process_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:33:inblock in process_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in block in instrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb:24:ininstrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb:180:in instrument' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/instrumentation.rb:32:inprocess_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal/params_wrapper.rb:245:in process_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/railties/controller_runtime.rb:27:inprocess_action' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/abstract_controller/base.rb:136:in process' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.4/lib/action_view/rendering.rb:39:inprocess' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal.rb:190:in dispatch' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_controller/metal.rb:254:indispatch' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:50:in dispatch' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:33:inserve' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:49:in block in serve' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:ineach' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:in serve' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:834:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/engine.rb:527:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/railtie.rb:190:inpublic_send' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/railtie.rb:190:in method_missing' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:19:inblock in ' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/mapper.rb:48:in serve' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:49:inblock in serve' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:in each' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/journey/router.rb:32:inserve' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/routing/route_set.rb:834:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/lib/katello/middleware/event_daemon.rb:10:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-dsl-2.3.0/lib/apipie_dsl/static_dispatcher.rb:67:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in call' ee1a0b01 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in call' ee1a0b01 | /usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/etag.rb:27:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/conditional_get.rb:27:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/head.rb:12:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/http/content_security_policy.rb:18:in call' ee1a0b01 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in context' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/cookies.rb:648:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/callbacks.rb:27:inblock in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb:101:in run_callbacks' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/callbacks.rb:26:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/debug_exceptions.rb:32:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/show_exceptions.rb:33:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:37:incall_app' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/rack/logger.rb:28:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:incall' ee1a0b01 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/remote_ip.rb:81:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/request_id.rb:27:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/lib/katello/prevent_json_parsing.rb:12:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/method_override.rb:24:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/runtime.rb:22:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/executor.rb:14:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/static.rb:126:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/sendfile.rb:110:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.4/lib/action_dispatch/middleware/host_authorization.rb:76:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/engine.rb:527:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/railtie.rb:190:inpublic_send' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/railtie.rb:190:in method_missing' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:74:inblock in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in each' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:incall' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.6/lib/puma/configuration.rb:228:in call' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.6/lib/puma/server.rb:713:inhandle_request' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.6/lib/puma/server.rb:472:in process_client' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.6/lib/puma/server.rb:328:inblock in run' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-4.3.6/lib/puma/thread_pool.rb:134:in block in spawn_thread' ee1a0b01 | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:inblock in create_with_logging_context' 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendering common/500.html.erb within layouts/application 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendered common/500.html.erb within layouts/application (Duration: 2.1ms | Allocations: 1301) 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendered layouts/_application_content.html.erb (Duration: 1.0ms | Allocations: 1351) 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendering layouts/base.html.erb 2021-02-26T14:32:59 [I|app|ee1a0b01] Rendered layouts/base.html.erb (Duration: 2.3ms | Allocations: 2778) 2021-02-26T14:32:59 [I|app|ee1a0b01] Completed 500 Internal Server Error in 29ms (Views: 7.7ms | ActiveRecord: 5.5ms | Allocations: 15355)

Foreman version: 2.3.2 Plugins:

fadamo commented 3 years ago

Hi,

reading https://github.com/theforeman/foreman_statistics/pull/22/files/34dd4d67c8c88aa40b57052392978088e8d0f40f

I did the following:

[root@XXXXXXXXXX:~]# diff -Naur /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/index.html.erb{,.orig} --- /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/index.html.erb 2021-02-26 14:48:05.066827757+0100 +++ /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foremanstatistics/trends/index.html.erb.orig 2020-09-30 12:45:48.000000000 +0200 @@ -1,6 +1,6 @@ <%= javascript 'charts' %> <% title ("Trends") %> -<% title_actions newlink(("Add Trend Counter"), engine: foreman_statistics), +<% title_actions newlink(("Add Trend Counter")), documentation_button('4.1.3Trends') %>

[root@XXXXXXXXXX:~]# diff -Naur /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/welcome.html.erb{,.orig} --- /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/welcome.html.erb 2021-02-26 14:49:06.964913337+0100 +++ /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_statistics-1.0.0/app/views/foreman_statistics/trends/welcome.html.erb.orig 2020-09-30 12:45:48.000000000 +0200 @@ -7,6 +7,6 @@

<%= _("Trends in Foreman allow you to track changes in your infrastructure over time. It allows you to track both Foreman related information and to any fact. The Trend pages give a graph of how the number of hosts with that value have changed over time, and list the current hosts.") %>

<%= link_to _('Learn more about this in the documentation.'), documentation_url("4.1.3Trends")%>

- <%= new_link(_("Add Trend Counter"), { engine: foreman_statistics }, :class => 'btn-lg') %> + <%= new_link(_("Add Trend Counter"), :class => 'btn-lg') %>
Now I reach the Trends page but when I click "add" I wait forever on a blank page. Bye
ezr-ondrej commented 3 years ago

Yeah this is in 2.4 only, so if you apply it manually, it should start working for you.

ezr-ondrej commented 3 years ago

Do you see any js error?

fadamo commented 3 years ago

Do you see any js error?

What I see is a blank frame and the tab loading for a long time. Using Dev Tools I see I receive 30MB (!) of data, with the "new" page large about 1,2MB but apparently conpletely empty.

If you want I can share a screenshot.

Thanks a lot.

ezr-ondrej commented 3 years ago

Can you try to enter the url <foreman_host>/foreman_statistics/trends/new manually and if that works verify where the Add Trend Counter button is redirecting you. :thinking:

fadamo commented 3 years ago

Can you try to enter the url <foreman_host>/foreman_statistics/trends/new manually and if that works verify where the Add Trend Counter button is redirecting you. 🤔

It doesn't work. The button links exactly https://xxxxxxxxxxxxxxx/foreman_statistics/trends/new.

fadamo commented 3 years ago

trends trends2

I hope here you can see something interesting.

ezr-ondrej commented 3 years ago

It all seem normal :thinking: Did you reassign the permissions to your user? the permissions were removed and recreated, so there can be something weird happening, unless you're admin ofc... You might try to upgrade to foreman 2.4, but apart of that I've got no idea. It all seems to be working, but the form just won't show up for some reason....

fadamo commented 3 years ago

I'm an Administrator. Ok, thank you very much for your time.

fraenki commented 3 months ago

PG::UndefinedTable: ERROR: relation "trends" does not exist How can I recreate the missing tables ?

But running foreman-rake db:migrate with plugin installed should recreate the plugin tables and allow you use the plugin again.

I ran into a similar issue on Foreman 3.10.0 and foreman_statistics-2.1.0, but in my case running db:migrate did not recreate the plugin tables. Is this still expected to work like this?

ezr-ondrej commented 3 months ago

It is expected to work, but I doubt it's been frequently tested, so it might go wrong. Did you see any errors?

fraenki commented 3 months ago

No, unfortunately no errors. Is there a manual way to rerun the db seed for this plugin? Maybe using foreman console?