Giter Site home page Giter Site logo

foreman_expire_hosts's People

Contributors

ares avatar dgoetz avatar evgeni avatar iakovgan avatar kamils-ironin avatar laugmanuel avatar mmoll avatar nagarjuna avatar ohadlevy avatar stejskalleos avatar timogoebel avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

foreman_expire_hosts's Issues

set up translations for this plugin

Strings in this plugin are prepared to be translated. We should extract the strings and publish them to transifex so translators can translate them.

No possibility to set permissions

Since Foreman 1.13 you can set permissions for everything and filter them.
To use your Plugin I have to be Administrator, otherwise I do not have the permissions even when I'm allowed to do everything else e.g. deleting a host.
Is there any possibility to add this?

Invalid expiration date upon multiple hosts expiration date change

Hello,
after upgrade Foreman to 1.24.3 and foreman_expire_hosts plugin to 7.0.0 we cannot update expiration date of hosts with "select action" button and getting "Invalid expiration date!" error.
Change of expiration date from host's properties is working as usual.

In logs we got only following with loglevel=debug:

2020-06-02T15:31:25 [I|app|3718ea40] Started POST "/expired_hosts/select_multiple_expiration" for 10.101.186.18 at 2020-06-02 15:31:25 +0300
2020-06-02T15:31:25 [I|app|3718ea40] Processing by HostsController#select_multiple_expiration as HTML
2020-06-02T15:31:25 [I|app|3718ea40] Parameters: {"host_ids"=>["35", "38"]}
2020-06-02T15:31:25 [D|tax|3718ea40] Current location set to SANDBOX/CDT
2020-06-02T15:31:25 [D|tax|3718ea40] Current organization set to Default Organization
2020-06-02T15:31:25 [I|app|3718ea40] Rendering /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-7.0.0/app/views/hosts/select_multiple_expiration.html.erb within layouts/application
2020-06-02T15:31:25 [I|app|3718ea40] Rendered hosts/_selected_hosts.html.erb (217.4ms)
2020-06-02T15:31:25 [I|app|3718ea40] Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-7.0.0/app/views/hosts/select_multiple_expiration.html.erb within layouts/application (649.3ms)
2020-06-02T15:31:25 [I|app|3718ea40] Rendered layouts/_application_content.html.erb (2.0ms)
2020-06-02T15:31:25 [I|app|3718ea40] Rendering layouts/base.html.erb
2020-06-02T15:31:25 [I|app|3718ea40] Rendered layouts/base.html.erb (39.6ms)
2020-06-02T15:31:25 [I|app|3718ea40] Completed 200 OK in 738ms (Views: 687.2ms | ActiveRecord: 18.7ms)
2020-06-02T15:31:37 [I|app|3eb5a718] Started POST "/expired_hosts/update_multiple_expiration?host_ids%5B%5D=35&host_ids%5B%5D=38" for 10.101.186.18 at 2020-06-02 15:31:37 +0300
2020-06-02T15:31:37 [I|app|3eb5a718] Processing by HostsController#update_multiple_expiration as HTML
2020-06-02T15:31:37 [I|app|3eb5a718] Parameters: {"utf8"=>"✓", "authenticity_token"=>"", "host"=>{"expired_on(1i)"=>"2021", "expired_on(2i)"=>"1", "expired_on(3i)"=>"1"}, "host_ids"=>["35", "38"]}
2020-06-02T15:31:37 [D|tax|3eb5a718] Current location set to SANDBOX/CDT
2020-06-02T15:31:37 [D|tax|3eb5a718] Current organization set to Default Organization
2020-06-02T15:31:37 [I|app|3eb5a718] Redirected to https://10.101.106.14/hosts
2020-06-02T15:31:37 [I|app|3eb5a718] Filter chain halted as :validate_multiple_expiration rendered or redirected
2020-06-02T15:31:37 [I|app|3eb5a718] Completed 302 Found in 11ms (ActiveRecord: 1.7ms)

Expiration date is not available using API call

Current version of foreman_expire_hosts plugin does not provide any method to query expiration date for specific host. Expiration date is available on host page when using UI but I can't find any way to get that value using API.

additional_recipients get mail notification with empty host list

This method needs a guard (e.g. return true if hosts.empty?) to check if the hosts array is not empty.

def deliver_mail_notification(recipient, hosts)
build_mail_notification(recipient, hosts).deliver_now
rescue SocketError, Net::SMTPError => error
message = _('Failed to deliver %{notification_name} for Hosts %{hosts}') % {
:notification_name => humanized_name,
:hosts => hosts.map(&:name).to_sentence
}
Foreman::Logging.exception(message, error)
end

Settings tab not shown in Foreman 1.18

The settings tab is not shown in Foreman 1.18, but the log is showing no failure.
Only thing relevant to expire hosts is Deface: [WARNING] No :original defined for 'host_form_expired_on_field', you should change its definition to include:

Notifications are sent separatelly per owner on hosts with multiple owners.

Hello guys,
We are working on configuration that mentioned in #9 ,
For hosts that used for team work, we use usergroups mapped from Active Directory as owners, so
that hosts have multiple owners. Foreman returns them in node YAML as:
owner_name: Usergroup_name
owner_email:

  • [email protected]
  • [email protected]
  • [email protected]
    When plugin send expiration notifications, it sends them one per user. So admins (we actually used jira queue, but stopped because of duplicates) receive a lot of duplicate messages with each of the owner in co-recepients. It seems to be more convinient when message is sent once to all owners and admin emails.

Status is always "error"

Every host gets an Expiration Status warning and sets the general status to error. It doens't matter if the expiration date is in two days or in one year.
(of cource only when i set an expiration date first)

Hosts are deleted one day before the mentioned deletion date

Hello,
On our current environment, Foreman 1.17, Foreman_expire_hosts-5.1.0 we notice that the hosts are deleted one day before the mentioned deletion date.

One example:
Mail received:

The following hosts have been expired in Foreman and will be stopped for now. These hosts will be destroyed on 2018-06-08. Please change their expiry date (Edit host and Additional information tab) and power them on if you want to keep the hosts.

Hostname	Host group	Environment	Expiration Date
sta-lc-bcm-02.example.com	appdev/STA/ALL/RHEL-7/LC/BrandingContentManager	appdev_lc	2018-04-26 (1 day ago)

Foreman audit:

07 Jun 07:45 Anonymous Admin destroyed Host: sta-lc-bcm-02.example.com

Expiry settings:

Name | Value | Description
-- | -- | --
Expiry e-mail recipients | XXX | All notifications will be delivered to its owner. If any other users/admins need to receive those expiry warning notifications then those emails can be configured comma separated here.
Require host expiry date | Yes | Make expiry date field mandatory on host creation/update
Second expiry notification | 1 | Send second notification to owner of hosts about his hosts expiring in given days. Must be integer only
Host owner can modify host expiry date | Yes | Allow host owner to modify host expiry date field. If the field is false then admin only can edit expiry field
First expiry notification | 7 | Send first notification to owner of hosts about his hosts expiring in given days. Must be integer only
Expiry grace period in days | 42 | Delete expired hosts after given days of hosts expiry date. Must be integer only

Expired Katello hosts are unable to be deleted

Expired hosts are unable to be deleted automatically. I can delete them using the API and from the webui. Logs below

/usr/sbin/foreman-rake expired_hosts:deliver_notifications

/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
rake aborted!
ActiveRecord::InvalidForeignKey: PG::Error: ERROR:  update or delete on table "hosts" violates foreign key constraint "katello_subscription_facets_host_id" on table "katello_subscription_facets"
DETAIL:  Key (id)=(226) is still referenced from table "katello_subscription_facets".
: DELETE FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = $1
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:602:in `exec_prepared'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:602:in `block in exec_cache'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:601:in `exec_cache'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:585:in `execute_and_clear'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:173:in `exec_delete'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:119:in `delete'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `delete'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation.rb:478:in `delete_all'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:487:in `destroy_row'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/counter_cache.rb:152:in `destroy_row'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/locking/optimistic.rb:115:in `destroy_row'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:172:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/callbacks.rb:292:in `block in destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_destroy_callbacks'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/callbacks.rb:292:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `block in destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `destroy'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.9/app/models/foreman_tasks/concerns/action_triggering.rb:33:in `block in destroy'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.9/app/models/foreman_tasks/concerns/action_triggering.rb:119:in `dynflow_task_wrap'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.9/app/models/foreman_tasks/concerns/action_triggering.rb:33:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:185:in `destroy!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/safe_destroy.rb:11:in `destroy!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/delete_expired_hosts.rb:11:in `action'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/base.rb:20:in `block in process'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/base.rb:19:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/base.rb:12:in `engage'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/lib/expire_hosts_notifications.rb:4:in `delete_expired_hosts'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/lib/tasks/expired_hosts.rake:6:in `block (3 levels) in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:93:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:99:in `as_anonymous_admin'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/lib/tasks/expired_hosts.rake:5:in `block (2 levels) in <top (required)>'
PG::Error: ERROR:  update or delete on table "hosts" violates foreign key constraint "katello_subscription_facets_host_id" on table "katello_subscription_facets"
DETAIL:  Key (id)=(226) is still referenced from table "katello_subscription_facets".
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:602:in `exec_prepared'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:602:in `block in exec_cache'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:601:in `exec_cache'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:585:in `execute_and_clear'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:173:in `exec_delete'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:119:in `delete'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/query_cache.rb:14:in `delete'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation.rb:478:in `delete_all'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:487:in `destroy_row'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/counter_cache.rb:152:in `destroy_row'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/locking/optimistic.rb:115:in `destroy_row'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:172:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/callbacks.rb:292:in `block in destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:117:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:505:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_destroy_callbacks'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/callbacks.rb:292:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `block in destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `destroy'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.9/app/models/foreman_tasks/concerns/action_triggering.rb:33:in `block in destroy'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.9/app/models/foreman_tasks/concerns/action_triggering.rb:119:in `dynflow_task_wrap'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.10.9/app/models/foreman_tasks/concerns/action_triggering.rb:33:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:185:in `destroy!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/safe_destroy.rb:11:in `destroy!'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/delete_expired_hosts.rb:11:in `action'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/base.rb:20:in `block in process'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/base.rb:19:in `process'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/app/services/foreman_expire_hosts/action/base.rb:12:in `engage'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/lib/expire_hosts_notifications.rb:4:in `delete_expired_hosts'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/lib/tasks/expired_hosts.rake:6:in `block (3 levels) in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:93:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:99:in `as_anonymous_admin'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-4.0.0/lib/tasks/expired_hosts.rake:5:in `block (2 levels) in <top (required)>'
Tasks: TOP => expired_hosts:deliver_notifications
(See full trace by running task with --trace)

Database seeding broken with Foreman 3.4

When trying to seed the database with Foreman 3.4 I get the following error:

 /usr/sbin/foreman-rake db:seed
Rubocop not loaded.
Rubocop not loaded.
Rubocop not loaded.
rake aborted!
ActiveModel::UnknownAttributeError: unknown attribute 'description' for Setting::ExpireHosts.
/usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute_assignment.rb:51:in `_assign_attribute'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/attribute_assignment.rb:21:in `block in _assign_attributes'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/attribute_assignment.rb:13:in `each'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/attribute_assignment.rb:13:in `_assign_attributes'
/usr/share/gems/gems/activemodel-6.1.6.1/lib/active_model/attribute_assignment.rb:34:in `assign_attributes'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/core.rb:518:in `initialize'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/inheritance.rb:72:in `new'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/inheritance.rb:72:in `new'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/persistence.rb:54:in `create!'
/usr/share/gems/gems/foreman_expire_hosts-7.0.4/app/models/setting/expire_hosts.rb:18:in `block (2 levels) in load_defaults'
/usr/share/gems/gems/foreman_expire_hosts-7.0.4/app/models/setting/expire_hosts.rb:18:in `each'
/usr/share/gems/gems/foreman_expire_hosts-7.0.4/app/models/setting/expire_hosts.rb:18:in `block in load_defaults'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/transactions.rb:209:in `transaction'
/usr/share/gems/gems/foreman_expire_hosts-7.0.4/app/models/setting/expire_hosts.rb:10:in `load_defaults'
/usr/share/foreman/app/services/setting_registry.rb:114:in `each'
/usr/share/foreman/app/services/setting_registry.rb:114:in `load'
/usr/share/foreman/config/initializers/foreman.rb:37:in `block in <top (required)>'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:427:in `instance_exec'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:427:in `block in make_lambda'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:198:in `block (2 levels) in halting'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:604:in `block (2 levels) in default_terminator'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:603:in `catch'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:603:in `block in default_terminator'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:199:in `block in halting'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:512:in `block in invoke_before'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:512:in `each'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:512:in `invoke_before'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:105:in `run_callbacks'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/reloader.rb:88:in `prepare!'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/application/finisher.rb:124:in `block in <module:Finisher>'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/initializable.rb:32:in `instance_exec'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/initializable.rb:32:in `run'
/usr/share/foreman/config/initializers/0_print_time_spent.rb:45:in `block in run'
/usr/share/foreman/config/initializers/0_print_time_spent.rb:17:in `benchmark'
/usr/share/foreman/config/initializers/0_print_time_spent.rb:45:in `run'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/initializable.rb:60:in `run_initializers'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/application.rb:391:in `initialize!'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
/usr/share/foreman/config/environment.rb:5:in `<top (required)>'
/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `block in require'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `require'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/application.rb:367:in `require_environment!'
/usr/share/gems/gems/railties-6.1.6.1/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:seed => db:load_config => environment
(See full trace by running task with --trace)

Forman_expire_hosts on a new Foreman(3.4) installation it trows an error: undefined method `datepicker_f' for

Forman_expire_hosts on a new Foreman(3.4) installation it trows an error:

when:

  • Create new host
  • Edit existing host

error:
undefined method `datepicker_f' for #ActionView::Base:0x0000000005ab90 Did you mean? datetime_f

installation:
foreman-installer -v --enable-foreman-plugin-expire-hosts
no errors during/after installation.

trace:

2022-11-21T11:12:30 [I|app|1d959f67] Started GET "/hosts/new" for 130.145.199.181 at 2022-11-21 11:12:30 +0100
2022-11-21T11:12:30 [I|app|1d959f67] Processing by HostsController#new as HTML
2022-11-21T11:12:31 [I|app|1d959f67]   Rendered hosts/new.html.erb within layouts/application (Duration: 477.2ms | Allocations: 273581)
2022-11-21T11:12:31 [I|app|1d959f67]   Rendered layout layouts/application.html.erb (Duration: 477.4ms | Allocations: 273636)
2022-11-21T11:12:31 [W|app|1d959f67] undefined method `datepicker_f' for #<ActionView::Base:0x0000000005ab90>
 1d959f67 | Did you mean?  datetime_f
2022-11-21T11:12:31 [I|app|1d959f67] Backtrace for 'undefined method `datepicker_f' for #<ActionView::Base:0x0000000005ab90>
 1d959f67 | Did you mean?  datetime_f' error (ActionView::Template::Error): undefined method `datepicker_f' for #<ActionView::Base:0x0000000005ab90>
 1d959f67 | Did you mean?  datetime_f
 1d959f67 | /usr/share/foreman/app/views/hosts/_form.html.erb:154:in `block (2 levels) in _6e62d1b6d08446df3b4955ffed6e9e2d'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/helpers/capture_helper.rb:45:in `block in capture'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/helpers/capture_helper.rb:209:in `with_output_buffer'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/helpers/capture_helper.rb:45:in `capture'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/helpers/form_helper.rb:450:in `form_for'
 1d959f67 | /usr/share/foreman/app/helpers/form_helper.rb:287:in `form_for'
 1d959f67 | /usr/share/foreman/app/views/hosts/_form.html.erb:7:in `block in _6e62d1b6d08446df3b4955ffed6e9e2d'
 1d959f67 | /usr/share/foreman/app/models/taxonomy.rb:80:in `block (2 levels) in as_taxonomy'
 1d959f67 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:195:in `as_location'
 1d959f67 | /usr/share/foreman/app/models/taxonomy.rb:79:in `block in as_taxonomy'
 1d959f67 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:154:in `as_org'
 1d959f67 | /usr/share/foreman/app/models/taxonomy.rb:78:in `as_taxonomy'
 1d959f67 | /usr/share/foreman/app/views/hosts/_form.html.erb:6:in `_6e62d1b6d08446df3b4955ffed6e9e2d'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/base.rb:247:in `public_send'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/base.rb:247:in `_run'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/template.rb:154:in `block in render'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:205:in `instrument'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/template.rb:345:in `instrument_render_template'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/template.rb:152:in `render'
 1d959f67 | /usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/partial_renderer.rb:285:in `block in render_partial_template'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/partial_renderer.rb:280:in `render_partial_template'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/partial_renderer.rb:271:in `render'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/renderer.rb:81:in `render_partial_to_object'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/renderer.rb:27:in `render_to_object'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/renderer.rb:22:in `render'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/helpers/rendering_helper.rb:38:in `block in render'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/base.rb:273:in `in_rendering_context'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/helpers/rendering_helper.rb:34:in `render'
 1d959f67 | /usr/share/foreman/app/views/hosts/new.html.erb:2:in `_f4f8d3d6b5ef4db66e854d34519ebddb'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/base.rb:247:in `public_send'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/base.rb:247:in `_run'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/template.rb:154:in `block in render'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:205:in `instrument'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/template.rb:345:in `instrument_render_template'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/template.rb:152:in `render'
 1d959f67 | /usr/share/gems/gems/deface-1.5.3/lib/deface/action_view_extensions.rb:43:in `render'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/template_renderer.rb:61:in `block (2 levels) in render_template'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/template_renderer.rb:56:in `block in render_template'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/template_renderer.rb:71:in `block in render_with_layout'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/template_renderer.rb:70:in `render_with_layout'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/template_renderer.rb:55:in `render_template'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/template_renderer.rb:11:in `render'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/rendering.rb:117:in `block in _render_template'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/base.rb:273:in `in_rendering_context'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/rendering.rb:116:in `_render_template'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/streaming.rb:218:in `_render_template'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/rendering.rb:103:in `render_to_body'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/rendering.rb:25:in `render'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/rendering.rb:36:in `render'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
 1d959f67 | /usr/share/ruby/benchmark.rb:308:in `realtime'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/core_ext/benchmark.rb:14:in `ms'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:46:in `block in render'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:86:in `cleanup_view_runtime'
 1d959f67 | /usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:45:in `render'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/implicit_render.rb:35:in `default_render'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `block in send_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `tap'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:228:in `process_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
 1d959f67 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 1d959f67 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 1d959f67 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 1d959f67 | /usr/share/gems/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 1d959f67 | /usr/share/gems/gems/audited-4.10.0/lib/audited/sweeper.rb:14:in `around'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `block in instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/notifications.rb:203:in `instrument'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
 1d959f67 | /usr/share/gems/gems/activerecord-6.1.6.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/abstract_controller/base.rb:165:in `process'
 1d959f67 | /usr/share/gems/gems/actionview-6.1.6.1/lib/action_view/rendering.rb:39:in `process'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal.rb:190:in `dispatch'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_controller/metal.rb:254:in `dispatch'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:50:in `block in serve'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:32:in `each'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/journey/router.rb:32:in `serve'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:842:in `call'
 1d959f67 | /usr/share/gems/gems/katello-4.6.0/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 1d959f67 | /usr/share/gems/gems/katello-4.6.0/lib/katello/middleware/event_daemon.rb:10:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/apipie-dsl-2.5.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 1d959f67 | /usr/share/gems/gems/apipie-rails-0.5.20/lib/apipie/static_dispatcher.rb:66:in `call'
 1d959f67 | /usr/share/gems/gems/apipie-rails-0.5.20/lib/apipie/extractor/recorder.rb:137:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/foreman/lib/foreman/middleware/libvirt_connection_cleaner.rb:9:in `call'
 1d959f67 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 1d959f67 | /usr/share/gems/gems/apipie-rails-0.5.20/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/tempfile_reaper.rb:15:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/etag.rb:27:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/conditional_get.rb:27:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/head.rb:12:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/http/permissions_policy.rb:22:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/http/content_security_policy.rb:19:in `call'
 1d959f67 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:266:in `context'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/session/abstract/id.rb:260:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/cookies.rb:689:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 1d959f67 | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/rack/logger.rb:37:in `call_app'
 1d959f67 | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/rack/logger.rb:28:in `call'
 1d959f67 | /usr/share/gems/gems/sprockets-rails-3.4.2/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 1d959f67 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
 1d959f67 | /usr/share/gems/gems/katello-4.6.0/lib/katello/prevent_json_parsing.rb:12:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/method_override.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/runtime.rb:22:in `call'
 1d959f67 | /usr/share/gems/gems/activesupport-6.1.6.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/static.rb:24:in `call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/sendfile.rb:110:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/ssl.rb:77:in `call'
 1d959f67 | /usr/share/gems/gems/actionpack-6.1.6.1/lib/action_dispatch/middleware/host_authorization.rb:142:in `call'
 1d959f67 | /usr/share/gems/gems/secure_headers-6.3.4/lib/secure_headers/middleware.rb:11:in `call'
 1d959f67 | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/engine.rb:539:in `call'
 1d959f67 | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
 1d959f67 | /usr/share/gems/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:74:in `block in call'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `each'
 1d959f67 | /usr/share/gems/gems/rack-2.2.4/lib/rack/urlmap.rb:58:in `call'
 1d959f67 | /usr/share/gems/gems/puma-5.6.4/lib/puma/configuration.rb:252:in `call'
 1d959f67 | /usr/share/gems/gems/puma-5.6.4/lib/puma/request.rb:77:in `block in handle_request'
 1d959f67 | /usr/share/gems/gems/puma-5.6.4/lib/puma/thread_pool.rb:340:in `with_force_shutdown'
 1d959f67 | /usr/share/gems/gems/puma-5.6.4/lib/puma/request.rb:76:in `handle_request'
 1d959f67 | /usr/share/gems/gems/puma-5.6.4/lib/puma/server.rb:441:in `process_client'
 1d959f67 | /usr/share/gems/gems/puma-5.6.4/lib/puma/thread_pool.rb:147:in `block in spawn_thread'
 1d959f67 | /usr/share/gems/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2022-11-21T11:12:31 [I|app|1d959f67]   Rendered common/500.html.erb within layouts/application (Duration: 6.8ms | Allocations: 6633)
2022-11-21T11:12:31 [I|app|1d959f67]   Rendered layouts/base.html.erb (Duration: 7.6ms | Allocations: 9266)
2022-11-21T11:12:31 [I|app|1d959f67]   Rendered layout layouts/application.html.erb (Duration: 22.9ms | Allocations: 27854)
2022-11-21T11:12:31 [I|app|1d959f67] Completed 500 Internal Server Error in 517ms (Views: 23.5ms | ActiveRecord: 28.9ms | Allocations: 305915)

Foreman version: 3.4.0
Plugins: 
 - foreman-tasks 7.0.0
 - foreman_ansible 9.0.1
 - foreman_bootdisk 21.0.2
 - foreman_expire_hosts 8.0.0
 - foreman_leapp 0.1.10
 - foreman_puppet 4.0.1
 - foreman_remote_execution 8.0.0
 - foreman_snapshot_management 2.0.1
 - foreman_templates 9.2.0
 - foreman_virt_who_configure 0.5.9
 - foreman_webhooks 3.0.5
 - katello 4.6.0

Allow creating a default expire period via host group

it would be useful to be able to set an expire period, something like 2 weeks or 3 days, and set it via a host group. This is useful for having hosts that are auto provisioned via discovery or some other means.

e-mails + date issues

Hello,
I am using v 2.0.1-1, installed via RPM.

Plugin config :

  • Expiry grace period in days : 30
  • First expiry notification : 20
  • Second expiry notification : 10

Host

  • Expiry date : 2016-10-20

Issues :

  • 1

Since the 2016-09-20, we receive everyday an email saying

The following hosts have been deleted from Foreman:

However, the host has not been deleted but stopped.

-> Seems like the wrong template is sent
-> Can it be sent once instead on everyday ?

  • 2

I understood the correct behavior would be that the host should be stopped on 2016-10-20, which make it unavailable/unreachable, then deleted 30 days later.

-> The host stopped 30 days earlier.

Are these issues already solved in 2.0.2 ?

Expired Host Menu Option No Longer Appears On Hosts Index

On the Host Index, there is no longer an option to bulk update expiration dates. It appears to be broken functionality in app/overrides/add_js_to_host_index.rb , which I can only presume is related to the move to React on the UI

Make notification templates configurable

Hello guys,
In our environment we don't allow owners to change expiration date, but current default notification warning
in /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-3.0.0/app/views/expire_hosts_mailer/expiry_warning_notification.html.erb
<%= _('The following hosts will be expired on %s. Please change expiry date if you want to keep these hosts alive.') % @expiry_date %>
seem confusing. So owners come to us and ask how they can change expiration date. To avoid this,
is it possible to make it configurable in UI or somewhere else? This is for stopped_hosts_notification.html.erb as well.
Yes, we can have our branch and merge releases with our fixtures, but I hope we are not alone.

Plugin doesn't work with Foreman 1.13.0

This Plugin doesn't work with the new Foreman-Version 1.13.0

The error-Message i get is:
undefined method `datepicker_f'
when i click on "new host"

or, when i select any host:
undefined method `host_expiry_warning_message'

I assume that somethin went wrong while importing this plugin

Expiration notifications are possibly broken in 3.0.0

Hi TFM team,

We have an issue with foreman_expire_hosts plugin: hosts' owners no longer receive notifications about host expiration and entering grace period.

I'll try to provide as many details as I can but I must say that I am not very familiar with Rails framework so please excuse me if my understanding of the situation isn't complete. I was not involved in this TFM configuration but I will try to contact any person who may have any useful information if needed.

Versions:

  • Foreman main application – 1.15.2;
  • foreman_expire_hosts plugin – 3.0.0.

Running rake command:

# /usr/sbin/foreman-rake --backtrace --rules -v expired_hosts:deliver_notifications

Produces the same error as in system logs (see below).

Please share any ideas if there's a way to fix this without major downtime or TFM instance reinstalling.
If this is not a bug but configuration/installation flaw -- comments on what is wrong would be great.

Thanks!


Log lines from /var/log/foreman/expired_hosts.log file:

rake aborted!
NoMethodError: undefined method `provided_attributes' for nil:NilClass
/usr/share/foreman/app/models/concerns/orchestration/compute.rb:29:in `compute_provides?'
/usr/share/foreman/app/models/nic/base.rb:169:in `compute_provides_ip?'
/usr/share/foreman/app/models/nic/managed.rb:78:in `ip6_available?'
/usr/share/foreman/app/models/concerns/orchestration/dns.rb:23:in `dns6?'
/usr/share/foreman/app/models/concerns/dns_interface.rb:29:in `dns_feasible?'
/usr/share/foreman/app/models/concerns/orchestration/dns.rb:84:in `block in queue_dns_destroy'
/usr/share/foreman/app/models/concerns/orchestration/dns.rb:82:in `each'
/usr/share/foreman/app/models/concerns/orchestration/dns.rb:82:in `queue_dns_destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:432:in `block in make_lambda'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:164:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:164:in `block in halting'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `block in call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_destroy_callbacks'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/callbacks.rb:292:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `block in destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/persistence.rb:185:in `destroy!'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/has_many_association.rb:171:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/has_many_association.rb:171:in `delete_records'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/collection_association.rb:525:in `remove_records'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/collection_association.rb:518:in `block in delete_or_destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/collection_association.rb:183:in `block in transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/collection_association.rb:182:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/collection_association.rb:518:in `delete_or_destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/collection_association.rb:279:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/collection_association.rb:223:in `destroy_all'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/has_many_association.rb:27:in `handle_dependency'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/associations/builder/association.rb:146:in `block in add_destroy_callbacks'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:448:in `instance_exec'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:448:in `block in make_lambda'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:164:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:164:in `block in halting'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `block in call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:504:in `call'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_destroy_callbacks'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/callbacks.rb:292:in `destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `block in destroy'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/transactions.rb:281:in `destroy'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-3.0.0/lib/expire_hosts_notifications.rb:27:in `block in delete_expired_hosts'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/relation/delegation.rb:46:in `each'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-3.0.0/lib/expire_hosts_notifications.rb:24:in `delete_expired_hosts'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_expire_hosts-3.0.0/lib/tasks/expired_hosts.rake:5:in `block (2 levels) in <top (required)>'
Tasks: TOP => expired_hosts:deliver_notifications
(See full trace by running task with --trace)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.