Provisioning Templates not visible after import

I’m may have a track on a solution already given the log message at the bottom, but I’m going to post this anyway.

Problem:
Fresh install of Foreman, added foreman_templates plugin.
After install, I use:
foreman-rake templates:purge
foreman-rake templates:import repo=https://my/github/repo/here

After import, partition tables and job templates are visible in UI, but provisioning templates are not there.
rake output appears that imports are/should be happening:

{:name=>“Preseed default PXEGrub2”,
:id=>252,
:changed=>false,
:imported=>true,
:additional_errors=>nil,
:exception=>nil,
:validation_errors=>{},
:file=>“preseed_default_pxegrub2.erb”,
:type=>“provisioning_template”},

Expected outcome:
Proviiosn
Foreman and Proxy versions:
Fresh install of Foreman 1.23 on CentOS 7.7 (not using 1.24 as I had issues with an upgrade recently). I’ve blown away the server and re-created twice with the same result.

Foreman and Proxy plugin versions:
foreman-1.23.1-1.el7.noarch
foreman-proxy-1.23.1-1.el7.noarch
tfm-rubygem-foreman_templates-6.0.3-2.fm1_23.el7.noarch

Distribution and version:
CentOS Linux release 7.7.1908 (Core)

Other relevant data:
While writing this, I caught this:
[E|app|] couldn’t save the template because of: Template kind can’t be blank

Okay, this went a totally different way than I thought.
-Removed templates that fail validation (2)
-No warnings in logs on import, still no provisioning templates visible in UI.
-Attempted to create manual template. Success… but not visible?
-hammer cli template list shows all provisioning templates!

Apparently this is a UI problem displaying the templates, though they do exist in the Foreman configuration. Suggestions?

Hi,

have you checked if the templates have assigned organization/location?
I would be a bit puzzled if this was actually the solution since partitioning and job templates are working, but it might be worth a try.
In the UI, go to the provisioning templates page. There, in the top bar, select “Any Organization” and “Any Location” from the drop-down menus. Can you see the templates after that?

Regards

Most likely as @areyus says, templates were not assigned to org/loc. The foreman-rake way is no longer recommended as it’s limited. I’d recommend check the hammer plugin for templates plugin, that allows you to say, what org/loc templates should be assigned to on import. Also a new version that is available for 1.24 adds a UI for import/export, so perhaps you can upgrade and try that.

It definitely did end up being the default org/location being unused - not sure why some imports would use the current default and some not, a bit inconsistent there.

I had similar issues with several other things of similar nature between the GUI and the hammer CLI trying to implement a fresh environment based on my prior proof of concept install.

First thing I did was create an org and location, set them as default, then started creating everything else. I had to use --no-use-defaults on a lot of things I created just so that I could see them in hammer list. Some commands being inconsistent from others, I had to --no-use-defaults to update them and fix them. This was despite me going into the web UI for my org/location and choosing the checkbox to use ‘all’ (smart proxies, subnets, medium, etc) prior to creating those objects.
An example that I had to use:

hammer --no-use-defaults template update --id N --organization-ids X --location-ids Y

In short, there appears to be a lot of inconsistency about use of default organization/location on hammer create operations as well as the template import process. Newly created OS and medium via hammer create definitely did not associate with the default site/location selection.

Just figured I’d report back. It’s not what I’d consider a bug, but certainly seems highly inconsistent from a user perspective.

1 Like