Closed treydock closed 6 years ago
@treydock, currently verbose mode doesn't work (if you don't want to see redundant verbose
option, you can upgrade this plugin to 0.1.1).
Unfortunately I couldn't reproduce the second problem. It works fine with those settings and hammer import-templates
imports and replaces modified via foreman templates. Could you provide more of the debug output from foreman as well as from hammer?
@ofedoren The second issue is more that the settings for the templates plugin are not used by the CLI interface so I have to explicitly pass things like --repo
instead of the value being pulled from settings stored in Foreman. When I used the templates Rake task I was able to run the rake command with no arguments as all values came from the settings set in GUI, like my screenshot in previous comment. Is that what your unable to reproduce?
@treydock yes. Because, as I said, I was using hammer import-templates
with no options at all, so everything was fetched from settings stored in Foreman (e.g. I changed repo
via Foreman GUI, ran import via Hammer) and it worked.
@ofedoren I added <%# FOO %>
to the template OSC - include
and then ran import and see this in debug:
{"name":"OSC - include","id":null,"changed":false,"imported":false,"additional_errors":"No 'model' found in metadata","exception":null,"validation_errors":{},"file":"OSC-include.erb","type":null}
The full log is here: https://pastebin.com/G73FcPSz. I truncated the logs before running the hammer import-templates
command and it appears like to POST
were made twice but the modification I made to one template remains.
@treydock thanks for the logs, it's much more clear now.
The problem is in templates' metadata. There is no model
specification in the template you are importing. See community templates which have recommended specifications in metadata.
@ofedoren Thanks for the pointer, adding model
and in some cases snippet: true
was necessary to fix template importing of our custom repo.
@ofedoren I don't know if appropriate but the hash that is returned by debug output like the hash below would be useful as output for CLI command:
{"name":"OSC - include","id":231,"changed":true,"imported":false,"additional_errors":null,"exception":null,"validation_errors":{"template_kind_id":"can't be blank"},"file":"OSC-include.erb","type":"provisioning_template"}
Maybe --verbose
would iterate over the debug array of hashes returned in templates
key and show if things changed or if there were any errors.
@treydock already thought about it as well :) I think the next release will return verbose
option with some output.
If there is nothing more to add to the current problem, can be this issue closed?
@ofedoren Ya, I'll close.
Does verbose import actually work? I'm used to using the rake task for import but that's broken at this moment (https://github.com/theforeman/foreman_templates/issues/101) and am used to seeing a diff when importing templates.
I modified one of my templates then ran verbose import, no diff.
The help output for
import-templates
showsverbose
but guessing that's just coming from API docs and maybe not supported by CLI tools? Would be very handy to support showing a diff.Other issue, I modified one of my templates and ran import and the modification is not removed. I'm guessing maybe my settings aren't being respected?
I enabled debug logging and don't see much:
The only way I got my import to work was by duplicating the settings I've already set in web UI: