GithubHelp home page GithubHelp logo

theforeman / foreman_puppet Goto Github PK

View Code? Open in Web Editor NEW
6.0 11.0 22.0 1.44 MB

Home Page: https://theforeman.org/plugins/foreman_puppet/

License: GNU General Public License v3.0

Ruby 45.65% HTML 3.08% Makefile 0.18% JavaScript 50.92% SCSS 0.17%
foreman provisioning puppet hacktoberfest

foreman_puppet's Introduction

ForemanPuppet

Gem Version GPL License

This plugin adds Puppet External node classification functionality to Foreman.

Features

  • Puppet dashboards
  • Puppet
    • Environments
    • Classes
    • Config groups
    • Smart Class parameters
  • Host / Hostgroup
    • Classes assignment
    • Environment assignment
    • Puppet proxy assignment
  • Puppet ENC (external node classifier)
  • Smartproxy Puppet status/tab
  • Template hostgroup / environment

Some features will remain in core:

  • PuppetCA
  • Report/Fact parsing

Compatibility

Foreman version Plugin version Notes
>= 3.7 ~> 6.0 Required
~> 3.5, 3.6 ~> 5.0 Required
~> 3.4 ~> 4.1 Required
~> 3.3 ~> 4.0 Required
~> 3.2 ~> 3.0 Required
~> 3.1 ~> 2.0 Required
~> 3.0 ~> 1.0 Required
~> 2.5 ~> 0.1 Optional; replaces Core features
< 2.5 - Not supported (functionality is in Core)

Installation

See How_to_Install_a_Plugin for how to install Foreman plugins

You can manually install this plugin using:

# On RedHat/CentOS
dnf install rubygem-foreman_puppet

# On Debian
apt install ruby-foreman-puppet

Usage

The usage is identical to the prior core functionality:

  • Import environments and classes from a Smartproxy
  • Optionally define Smart Class parameters
  • Assign environment and classes to Hosts / Hostgroups
  • Use the Puppet ENC on your Puppetserver(s) to query Foreman

Problems

Please feel free to open a new Github issue if you encounter any bugs/issues using this plugin.

Contributing

Fork and send a Pull Request. Thanks!

Copyright

Copyright (c) 2020-2023 The Foreman developers

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

foreman_puppet's People

Contributors

amirfefer avatar archanaserver avatar ares avatar ekohl avatar evgeni avatar ezr-ondrej avatar kamils-ironin avatar laugmanuel avatar lzap avatar manisha15 avatar mariaaga avatar nadjaheitmann avatar pkoprda avatar ron-lavi avatar shiramax avatar stejskalleos avatar tbrisker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

foreman_puppet's Issues

Host puppetclass assignment results in error and broken class list

While editing a host and assigning puppet related configuration (puppetserver, environment, classes), the save fails with:

11:23:39 rails.1   | 2021-04-06T11:23:39 [I|app|0e511529] Started PATCH "/hosts/41" for ::1 at 2021-04-06 11:23:39 +0200
11:23:39 rails.1   | 2021-04-06T11:23:39 [I|app|0e511529] Processing by HostsController#update as */*
11:23:39 rails.1   | 2021-04-06T11:23:39 [I|app|0e511529]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"s6wHzWYI1dXVcg+acn1PQ1lHE4QTjBS/a+UI4nB2jqYZyBKV6OdWTQTDX9vHCHVG7Ud/F8BFAjq8s0LZuYFcHQ==", "host"=>{"name"=>"louis-tatem", "hostgroup_id"=>"", "puppet_attributes"=>{"environment_id"=>"1"}, "puppet_proxy_id"=>"1", "puppetclass_ids"=>["", "1"], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "mac"=>"aa:bb:cc:dd:ee:ff", "identifier"=>"", "name"=>"louis-tatem", "domain_id"=>"2", "subnet_id"=>"1", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "tag"=>"", "attached_to"=>"", "id"=>"41"}}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "medium_id"=>"1", "ptable_id"=>"97", "pxe_loader"=>"", "disk"=>"", "root_pass"=>"[FILTERED]", "is_owned_by"=>"4-Users", "enabled"=>"1", "model_id"=>"", "expired_on"=>"", "comment"=>"", "overwrite"=>"false"}, "id"=>"41"}
11:23:39 rails.1   | 2021-04-06T11:23:39 [D|tax|0e511529] Current location set to Default Location
11:23:39 rails.1   | 2021-04-06T11:23:39 [D|tax|0e511529] Current organization set to Default Organization
11:23:39 rails.1   | 2021-04-06T11:23:39 [D|tax|0e511529] Current organization set to none
11:23:39 rails.1   | 2021-04-06T11:23:39 [D|tax|0e511529] Current location set to none
11:23:39 rails.1   | 2021-04-06T11:23:39 [D|app|0e511529] Unpermitted parameter: :puppet_attributes
11:23:39 rails.1   | 2021-04-06T11:23:39 [I|app|0e511529] Unable to suggest IP: subnet Subnet #1 don't have a DHCP proxy associated, a proxy is not in subnets organization or IPAM is not set to DHCP
11:23:39 rails.1   | 2021-04-06T11:23:39 [W|app|0e511529] Not queueing Nic::Managed: ["Environment with id 1 doesn't exist or is not assigned to proper organization and/or location"]
11:23:39 rails.1   | 2021-04-06T11:23:39 [W|app|0e511529] Not queueing Nic::Managed: ["Environment with id 1 doesn't exist or is not assigned to proper organization and/or location"]
11:23:39 rails.1   | 2021-04-06T11:23:39 [W|app|0e511529] Not queueing Nic::Managed: ["Environment with id 1 doesn't exist or is not assigned to proper organization and/or location"]
11:23:39 rails.1   | 2021-04-06T11:23:39 [E|app|0e511529] Failed to save: Environment with id 1 doesn't exist or is not assigned to proper organization and/or location
11:23:39 rails.1   | 2021-04-06T11:23:39 [I|app|0e511529]   Rendering hosts/edit.html.erb within layouts/application
11:23:39 rails.1   | 2021-04-06T11:23:39 [I|app|0e511529]   Rendered hosts/_progress.html.erb (Duration: 1.9ms | Allocations: 138)
11:23:39 rails.1   | 2021-04-06T11:23:39 [D|tax|0e511529] Current organization set to Default Organization
11:23:39 rails.1   | 2021-04-06T11:23:39 [D|tax|0e511529] Current location set to Default Location
[...]
11:23:40 rails.1   | 2021-04-06T11:23:40 [W|app|0e511529] user: Manuel.Laug
11:23:40 rails.1   |  0e511529 | PATCH /hosts/41
11:23:40 rails.1   |  0e511529 | AVOID eager loading detected
11:23:40 rails.1   |  0e511529 |   ForemanPuppet::Puppetclass => [:environment_classes]
11:23:40 rails.1   |  0e511529 |   Remove from your query: .includes([:environment_classes])
11:23:40 rails.1   |  0e511529 | Call stack
11:23:40 rails.1   |  0e511529 |   /Users/Manuel.Laug/_dev/_github/theforeman/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
11:23:40 rails.1   |  0e511529 |   /Users/Manuel.Laug/_dev/_github/theforeman/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
11:23:40 rails.1   |  0e511529 |   /Users/Manuel.Laug/_dev/_github/theforeman/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
11:23:40 rails.1   |  0e511529 |   /Users/Manuel.Laug/_dev/_github/theforeman/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
11:23:40 rails.1   |  0e511529 |
11:23:40 rails.1   |  0e511529 |

After that, the class seems to be associated (as seen in the screenshot and console), but deleting the class (using the minus button) does not work.
image

[2] pry(main)> Host.find_by(name: 'louis-tatem.lxsbx.example.com').classes
=> [#<ForemanPuppet::Puppetclass:0x00007fe4367d3a08 id: 1, name: "test", created_at: Tue, 06 Apr 2021 09:14:37 UTC +00:00, updated_at: Tue, 06 Apr 2021 09:14:37 UTC +00:00>]

We've used:

foreman develop branch (commit 744f9bd00597710883c6db1dfa37f3ca22cc18c5)
foreman_puppet master branch (commit fdeef1dc6febcfae22c8d3273cb18d6bdeb31a23)

environment defined in hostgroup is not used by Puppet node

Components versions

  • Foreman version used : 3.0.1
  • OS version used on Foreman host: Ubuntu 20.04
  • OS version used on Puppet node: Ubuntu 20.04
  • Puppet version used : Pupperserver and Puppet agent (AIO package) are both 7.12

What is observed

Node does not inherit its environment from its hostgroup.

How to reproduce

  • Create a hostgroup with a defined environment different from production like customenv
  • Modify a node for using this hostgroup and click Inherit about Environement
  • use puppet agent --test on the node

What is expected

During the Puppet run the environement should be customenv and not production

Note

This was working with Foreman 2.x

ENC no longer working after migration from 2.5.4 -> 3.0.1+foreman_puppet

Hi folk! Given the backtrace, this seems like the most likely place to discuss the cause of this. I can no longer use my Foreman server as an ENC after I upgraded to 3.0.1. What I get in the logs is:

2021-11-11T15:42:22 [I|app|5f4b1bec] Started GET "/node/XXXHOST?format=yml" for 10.50.61.64 at 2021-11-11 15:42:22 -0500
2021-11-11T15:42:22 [I|app|5f4b1bec] Processing by HostsController#externalNodes as YML
2021-11-11T15:42:22 [I|app|5f4b1bec]   Parameters: {"name"=>"XXXHOST"}
2021-11-11T15:42:22 [W|app|5f4b1bec] Failed to generate external nodes for XXXHOST
2021-11-11T15:42:22 [I|app|5f4b1bec] Backtrace for 'Failed to generate external nodes for XXXHOST' error (TypeError): no implicit conversion of nil into Array
 5f4b1bec | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:87:in `+'
 5f4b1bec | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:87:in `+'
 5f4b1bec | /usr/share/gems/gems/foreman_puppet-1.0.4/app/services/foreman_puppet/host_info_providers/config_groups_info.rb:7:in `host_info'
 5f4b1bec | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:27:in `block in info'
 5f4b1bec | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:25:in `each'
 5f4b1bec | /usr/share/foreman/app/models/concerns/host_info_extensions.rb:25:in `info'
 5f4b1bec | /usr/share/gems/gems/foreman_puppet-1.0.4/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb:100:in `block in externalNodes'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/mime_responds.rb:205:in `respond_to'
 5f4b1bec | /usr/share/gems/gems/foreman_puppet-1.0.4/app/controllers/concerns/foreman_puppet/extensions/hosts_controller_extensions.rb:96:in `externalNodes'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/base.rb:195:in `process_action'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rendering.rb:30:in `process_action'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
 5f4b1bec | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 5f4b1bec | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 5f4b1bec | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 5f4b1bec | /usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 5f4b1bec | /usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:139:in `run_callbacks'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/callbacks.rb:41:in `process_action'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rescue.rb:22:in `process_action'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `block in instrument'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `instrument'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
 5f4b1bec | /usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/base.rb:136:in `process'
 5f4b1bec | /usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/rendering.rb:39:in `process'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal.rb:190:in `dispatch'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal.rb:254:in `dispatch'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:49:in `block in serve'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:32:in `each'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:32:in `serve'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:834:in `call'
 5f4b1bec | /usr/share/gems/gems/apipie-dsl-2.4.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 5f4b1bec | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:in `call'
 5f4b1bec | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 5f4b1bec | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 5f4b1bec | /usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 5f4b1bec | /usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/conditional_get.rb:27:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 5f4b1bec | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/cookies.rb:648:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:101:in `run_callbacks'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 5f4b1bec | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/rack/logger.rb:37:in `call_app'
 5f4b1bec | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/rack/logger.rb:28:in `call'
 5f4b1bec | /usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 5f4b1bec | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/request_id.rb:27:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
 5f4b1bec | /usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/executor.rb:14:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
 5f4b1bec | /usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
 5f4b1bec | /usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:in `call'
 5f4b1bec | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/engine.rb:527:in `call'
 5f4b1bec | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/railtie.rb:190:in `public_send'
 5f4b1bec | /usr/share/gems/gems/railties-6.0.3.7/lib/rails/railtie.rb:190:in `method_missing'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each'
 5f4b1bec | /usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call'
 5f4b1bec | /usr/share/gems/gems/puma-5.3.2/lib/puma/configuration.rb:249:in `call'
 5f4b1bec | /usr/share/gems/gems/puma-5.3.2/lib/puma/request.rb:77:in `block in handle_request'
 5f4b1bec | /usr/share/gems/gems/puma-5.3.2/lib/puma/thread_pool.rb:338:in `with_force_shutdown'
 5f4b1bec | /usr/share/gems/gems/puma-5.3.2/lib/puma/request.rb:76:in `handle_request'
 5f4b1bec | /usr/share/gems/gems/puma-5.3.2/lib/puma/server.rb:438:in `process_client'
 5f4b1bec | /usr/share/gems/gems/puma-5.3.2/lib/puma/thread_pool.rb:145:in `block in spawn_thread'
 5f4b1bec | /usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2021-11-11T15:42:22 [I|app|5f4b1bec]   Rendering text template
2021-11-11T15:42:22 [I|app|5f4b1bec]   Rendered text template (Duration: 0.0ms | Allocations: 1)
2021-11-11T15:42:22 [I|app|5f4b1bec] Completed 412 Precondition Failed in 30ms (Views: 0.4ms | ActiveRecord: 9.0ms | Allocations: 8433)

Any ideas what might be causing this? I've yet to be able to track down an actual cause, but to be fair I also haven't taken a dive into the plugin's code.

ENC should use valid Puppet variable names

Currently the Puppet ENC output from Foreman simply takes host parameters as defined, and pushes them into the parameters hash without modification.

The Puppet documentation states: "If present, the value of the parameters key must be a hash of valid variable names and associated values".
https://puppet.com/docs/puppet/7.5/nodes_external.html#enc_output_format-section_rbt_2vm_thb

It is currently possible to use dashes in host parameter names, which are then populated into the ENC output; however, variables may not contain dashes in Puppet.
As a result, host parameters containing dashes are not accessible within Puppet.
(Note: they were previously accessible using the getvar function in Puppet 5, but this no longer works in Puppet 6+).

While it is possible to work around this issue manually by simply not using dashes in host parameters, there are some dashed host parameters that are used in provisioning templates (such as http-proxy), which are useful in Puppet as well. A current workaround is to define the value twice, once for the templates and one for the ENC value for Puppet, but this is inconvenient and prone to accidental drift.

The Foreman ENC output should convert dashes to underscores for host parameter names containing dashes.

Redirect core routes to use plugin routes

Refers to #151 (comment) .

As of now, old API routes are still active.

[I|app|e93963d1] Started GET "/api/puppetclasses" for 192.168.121.1 at 2021-06-01 06:45:45 +0000$
[I|app|e93963d1] Processing by Api::V2::PuppetclassesController#index as JSON

Two possibilities:

  1. redirect the routes for now (seems easier in terms of implementation and more user friendly for current API users)
  2. disable routes (we be done eventually, even if we implement the redirection for now)

Fixup `documentation_url`s

In welcome pages we have links to documentation.

e.g documentation_url("using-config-groups")

We need reroute to the plugin documentation once it's there.

Creating an environment named `production` fails

When creating a new Puppet environment named production, the creation fails:
image

The environment does indeed exist if I check using rake console - the GUI seems to not show it:

[5] pry(main)> Environment.all
=> [#<Environment:0x00007fa76b654fe0
  id: 1,
  name: "production",
  created_at: Fri, 14 May 2021 11:07:45 UTC +00:00,
  updated_at: Fri, 14 May 2021 11:07:45 UTC +00:00>]

URL: http://localhost:5000/foreman_puppet/environments
Foreman branch: 2.5-stable
Plugin: master

Smart proxy apidoc inconsistency

Environments and smart proxies both have the same API endpoint for importing puppet classes. I tried to prepend the smart_proxy path with `foreman_puppet' for #170 but so far no success. It is a bit tricky because it is defined as concern. Any ideas?

image
image

API working in hammer and fam

Puppet related Foreman Ansible Modules need to be updated after changes in the API.

There might be need for more discussion about API changes in general.

PG::UndefinedColumn: ERROR: column host_classes.host_puppet_facet_id does not exist

Not sure if this has to do with the plugin of foreman itself. But I did an update to 2.5 and as noted I tried installing the foreman_puppet as it will be removed from core in the future.

Since I did not see the plugin listed with 'foreman-installer' I used the manual install with yum install tfm-rubygem-foreman_puppet. As soon as I installed the plugin I get:

Oops, we're sorry but something went wrong PG::UndefinedColumn: ERROR: column host_classes.host_puppet_facet_id does not exist LINE 1: SELECT "host_classes".* FROM "host_classes" WHERE "host_clas... ^ 

When:

  • I try to edit a host
  • I go to config->classes
  • Probably more

A migrate gives me error:

== 20201125113903 MigratePuppetclassesToFacets: migrating =====================
-- add_reference(:host_classes, :host_puppet_facet, {:foreign_key=>true, :index=>true})
   -> 0.0191s
-- add_reference(:hostgroup_classes, :hostgroup_puppet_facet, {:foreign_key=>true, :index=>true})
   -> 0.0125s
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
<snip>
Caused by:
NoMethodError: undefined method `id' for nil:NilClass
<snip>

Any idea what could be the issue? If you need any other info, let me know.

hammer location add-environment does not work because of API deprecations

If you run hammer location add-environment --id ENV_ID --puppet-environment ENV_NAME, it will add the location/organization to the environment, as requested, but it will delete the location/organization settings for all other environments.

It is internally processed with Api::V2::LocationsController#update and Parameters: {"location"=>{"environment_ids"=>["9"]}, "apiv"=>"v2", "id"=>"2"} .

Tested with Forklift, foreman core theforeman/foreman@fc082e8 and foreman puppet 3069d90

Curl:
curl -X PUT -k -H 'Content-Type: application/json' -H 'Authorization: Basic YWRtaW46Y2hhbmdlbWU=' -i 'https://centos7-katello-devel-stable.example.com/api/locations/2' --data '{ "location": { "environment_ids" : [ "9" ] } }

API inconsistencies

There some inconsistencies in the API regarding

  • documentation/apidoc missing
  • parameters (some not listed, some optional although they should not be)
  • documentation showing up in a separate block in apidoc

Configure --> Puppet ENC menu inconsistent

There is a menu entry Puppet in Configure where Environments can be chosen (link leads to core controller).
The Environments entry for Puppet ENC is missing.

Tested on my Forklift with
foreman_puppet master (6f811b1)
foreman 2.5-stable (e880002a8edff382cb53ffea136d2e527132df13)

path821

Internal on SmartProxy -> Puppet tab

Oops, we’re sorry but something went wrong undefined method `host_config_reports_path’ for #<#Class:0x000055acd4b83f40:0x000055acd4b707b0> Did you mean? host_title_actions

If you feel this is an error with Foreman itself, please open a new issue with Foreman ticketing system, Please include in your report the full error log that can be acquired by running: foreman-rake errors:fetch_log request_id=f642dc8d and it is highly recommended to also attach the foreman-debug output.

from https://community.theforeman.org/t/foreman-3-0-1-settings-error/25297

Host creation using fact import fails with 500

I've tried to create a new host in Foreman using POST at /api/hosts/facts. This results in a 500 Internal server error.

13:13:29 rails.1   | 2021-05-14T13:13:29 [I|app|08484bdf] Started POST "/api/v2/hosts/facts" for ::1 at 2021-05-14 13:13:29 +0200
13:13:29 rails.1   | 2021-05-14T13:13:29 [I|app|08484bdf] Processing by Api::V2::HostsController#facts as JSON
13:13:29 rails.1   | 2021-05-14T13:13:29 [I|app|08484bdf]   Parameters: {"name"=>"test-host-2021-05-14-13-13-28-02b9", "facts"=>"[FILTERED]", "apiv"=>"v2", "host"=>{"name"=>"test-host-2021-05-14-13-13-28-02b9"}}
13:13:29 rails.1   | 2021-05-14T13:13:29 [D|app|08484bdf] Verifying request from ["localhost"] against ["localhost"]
13:13:29 rails.1   | 2021-05-14T13:13:29 [I|app|08484bdf] Import facts for 'test-host-2021-05-14-13-13-28-02b9' completed. Added: 431, Updated: 0, Deleted 0 facts
13:13:33 rails.1   | 2021-05-14T13:13:33 [I|aud|08484bdf] Nic::Managed (5) create event on mac
[...]
13:13:33 rails.1   | 2021-05-14T13:13:33 [I|aud|08484bdf] Nic::Managed (5) update event on name test-host-2021-05-14-13-13-28-02b9, test-host-2021-05-14-13-13-28-02b9.foo.example.local
13:13:33 rails.1   | 2021-05-14T13:13:33 [W|app|08484bdf] Action failed
13:13:33 rails.1   | 2021-05-14T13:13:33 [I|app|08484bdf] Backtrace for 'Action failed' error (NoMethodError): undefined method `environment' for #<Class:0x00007f975ced8e60>
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/.rvm/gems/ruby-2.7.2/gems/activerecord-6.0.3.4/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman_puppet/app/models/foreman_puppet/host_puppet_facet.rb:24:in `populate_fields_from_facts'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/models/concerns/facets/base_host_extensions.rb:26:in `block in populate_facet_fields'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/models/concerns/facets/base_host_extensions.rb:25:in `each'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/models/concerns/facets/base_host_extensions.rb:25:in `populate_facet_fields'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/models/host/managed.rb:506:in `populate_fields_from_facts'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/models/concerns/puppet_host_extensions.rb:3:in `populate_fields_from_facts'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/services/host_fact_importer.rb:51:in `block (2 levels) in parse_facts'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/services/foreman/telemetry_helper.rb:27:in `telemetry_duration_histogram'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/services/host_fact_importer.rb:50:in `block in parse_facts'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/services/host_fact_importer.rb:91:in `block in skipping_orchestration'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/models/concerns/orchestration.rb:124:in `without_orchestration'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/services/host_fact_importer.rb:90:in `skipping_orchestration'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/services/host_fact_importer.rb:45:in `parse_facts'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/services/host_fact_importer.rb:34:in `import_facts'
13:13:33 rails.1   |  08484bdf | /Users/Manuel.Laug/_dev/_github/theforeman/foreman/app/controllers/api/v2/hosts_controller.rb:307:in `facts'

Running the latest Foreman with the plugin breaks Provisioning templates page

Try navigating to the Hosts -> Provisioning Templates, see the 500 error, here's the trace.

2021-08-03T14:56:28 [I|app|b90900d8] Started GET "/templates/provisioning_templates" for 192.168.22.12 at 2021-08-03 14:56:28 +0200
2021-08-03T14:56:28 [I|app|b90900d8] Processing by ProvisioningTemplatesController#index as HTML
2021-08-03T14:56:29 [W|app|b90900d8] undefined method `key?' for :template_kind:Symbol
2021-08-03T14:56:29 [I|app|b90900d8] Backtrace for 'undefined method `key?' for :template_kind:Symbol' error (NoMethodError): undefined method `key?' for :template_kind:Symbol
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_puppet-1.0.0.rc.1/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb:49:in `block in template_includes'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_puppet-1.0.0.rc.1/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb:49:in `each'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_puppet-1.0.0.rc.1/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb:49:in `detect'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_puppet-1.0.0.rc.1/app/models/concerns/foreman_puppet/extensions/provisioning_template.rb:49:in `template_includes'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:66:in `block in template_includes'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation.rb:407:in `block in scoping'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation.rb:784:in `_scoping'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation.rb:407:in `scoping'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/relation/delegation.rb:66:in `template_includes'
 b90900d8 | /usr/share/foreman/app/controllers/templates_controller.rb:15:in `index'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/base.rb:195:in `process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rendering.rb:30:in `process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:112:in `block in run_callbacks'
 b90900d8 | /usr/share/foreman/app/controllers/concerns/foreman/controller/timezone.rb:10:in `set_timezone'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 b90900d8 | /usr/share/foreman/app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 b90900d8 | /usr/share/foreman/app/controllers/concerns/foreman/controller/topbar_sweeper.rb:12:in `set_topbar_sweeper_controller'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/sweeper.rb:14:in `around'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:139:in `run_callbacks'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/callbacks.rb:41:in `process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/rescue.rb:22:in `process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `block in instrument'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications.rb:180:in `instrument'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/abstract_controller/base.rb:136:in `process'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionview-6.0.3.7/lib/action_view/rendering.rb:39:in `process'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal.rb:190:in `dispatch'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_controller/metal.rb:254:in `dispatch'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:33:in `serve'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:49:in `block in serve'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:32:in `each'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/journey/router.rb:32:in `serve'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/routing/route_set.rb:834:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.2.0.pre.master/lib/katello/middleware/organization_created_enforcer.rb:18:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.2.0.pre.master/lib/katello/middleware/event_daemon.rb:10:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-dsl-2.4.0/lib/apipie_dsl/static_dispatcher.rb:67:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/static_dispatcher.rb:66:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/extractor/recorder.rb:137:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /usr/share/foreman/lib/foreman/middleware/telemetry.rb:10:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-rails-0.5.17/lib/apipie/middleware/checksum_in_headers.rb:27:in `call'
 b90900d8 | /usr/share/foreman/lib/foreman/middleware/catch_json_parse_errors.rb:9:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/etag.rb:27:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/conditional_get.rb:27:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
 b90900d8 | /usr/share/foreman/lib/foreman/middleware/logging_context_session.rb:22:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:266:in `context'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/session/abstract/id.rb:260:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/cookies.rb:648:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/callbacks.rb:101:in `run_callbacks'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.7/lib/rails/rack/logger.rb:37:in `call_app'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.7/lib/rails/rack/logger.rb:28:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
 b90900d8 | /usr/share/foreman/lib/foreman/middleware/logging_context_request.rb:11:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/request_id.rb:27:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.2.0.pre.master/lib/katello/prevent_json_parsing.rb:12:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/executor.rb:14:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/static.rb:126:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/actionpack-6.0.3.7/lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/secure_headers-6.3.0/lib/secure_headers/middleware.rb:11:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.7/lib/rails/engine.rb:527:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.7/lib/rails/railtie.rb:190:in `public_send'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.7/lib/rails/railtie.rb:190:in `method_missing'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:74:in `block in call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `each'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/rack-2.2.3/lib/rack/urlmap.rb:58:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.3.2/lib/puma/configuration.rb:249:in `call'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.3.2/lib/puma/request.rb:77:in `block in handle_request'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.3.2/lib/puma/thread_pool.rb:338:in `with_force_shutdown'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.3.2/lib/puma/request.rb:76:in `handle_request'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.3.2/lib/puma/server.rb:438:in `process_client'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/puma-5.3.2/lib/puma/thread_pool.rb:145:in `block in spawn_thread'
 b90900d8 | /opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.3.0/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
2021-08-03T14:56:29 [I|app|b90900d8]   Rendering common/500.html.erb within layouts/application
2021-08-03T14:56:29 [I|app|b90900d8]   Rendered common/500.html.erb within layouts/application (Duration: 7.4ms | Allocations: 6911)
2021-08-03T14:56:29 [I|app|b90900d8]   Rendered layouts/_application_content.html.erb (Duration: 4.3ms | Allocations: 6401)
2021-08-03T14:56:29 [I|app|b90900d8]   Rendering layouts/base.html.erb
2021-08-03T14:56:29 [I|app|b90900d8]   Rendered layouts/base.html.erb (Duration: 12.5ms | Allocations: 10270)
2021-08-03T14:56:29 [I|app|b90900d8] Completed 500 Internal Server Error in 112ms (Views: 34.9ms | ActiveRecord: 5.2ms | Allocations: 52466)

Foreman version: 3.0.0-develop
Plugins: 
 - foreman-tasks 5.0.0
 - foreman_ansible 6.4.1
 - foreman_azure_rm 2.2.5
 - foreman_bootdisk 17.1.0
 - foreman_discovery 17.0.0
 - foreman_kubevirt 0.1.9
 - foreman_leapp 0.1.7
 - foreman_openscap 4.3.3
 - foreman_puppet 1.0.0.rc.1
 - foreman_remote_execution 4.6.0
 - foreman_rh_cloud 4.0.24.1
 - foreman_templates 9.1.0
 - foreman_virt_who_configure 0.5.6
 - foreman_webhooks 2.0.0
 - katello 4.2.0.pre.master
 - redhat_access 2.2.20

foreman_puppet/app/models/foreman_puppet/host_puppet_facet.rb: parent_config_groups() should not return 'nil'

source: foreman_puppet/app/models/foreman_puppet/host_puppet_facet.rb, line51.
method parent_config_groups() should not return a nil value, since that results in an exception in callers. This happens in the puppet node classifier code path whenever a hostgroup is encountered that does not have any puppet plugin data.

The patch indicated below fixes this issue.

    def parent_config_groups
          return [] unless host.hostgroup
          host.hostgroup.puppet&.all_config_groups || []
                                                   ^^^^^^
    end

Test against develop

We are testing against custom branch now, we should switch back to testing against develop as most of the fixes are in the develop now.

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.