Foreman-rake "Don't know how to build task 'templates:purge'"

I'm running CentOS 6 with SCL, and we're still on Foreman 1.11.

I'm trying to work with foreman_templates
<https://github.com/theforeman/foreman_templates> to update my templates. I
installed foreman_templates a few weeks ago using foreman-installer and I
thought it was working then.

However, when I run certain foreman-installer tasks, I get errors about
'Don't know how to build task', and others. I get essentially the same
error inside and outside of the TFM SCL environment.

I'm not very experienced with foreman-rake. Any idea what's going on?

[root@puppet ~]# foreman-rake templates:purge
rake aborted!
Don't know how to build task 'templates:purge'

(See full trace by running task with --trace)
[root@puppet ~]#

[root@puppet ~]# scl enable tfm bash
[root@puppet ~]# foreman-rake templates:purge prefix='Oops '
rake aborted!
Don't know how to build task 'templates:purge'
[root@puppet ~]# foreman-rake templates:purge prefix='Oops ' --trace
rake aborted!
Don't know how to build task 'templates:purge'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task_manager
.rb:62:in []&#39; /opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:149:in invoke_task'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in
block (2 levels) in top_level&#39; /opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application. rb:106:in each'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in
block in top_level&#39; /opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in run_with_threads'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.
rb:100:in top_level&#39; /opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in block in run'
/opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in
standard_exception_handling&#39; /opt/rh/rh-ruby22/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application. rb:75:in run'
/opt/rh/rh-ruby22/root/usr/bin/rake:33:in `<main>'
[root@puppet ~]#

-= Stefan

It's unlikely that the version you have installed contains this feature.
It appears to be in version 3.0.0, but it was released for Foreman 1.12
and higher. You can check your version from the About page or by running
foreman-rake plugin:list.

Ensure you read the docs for the version of any plugin you're running by
installing the -doc package (e.g. tfm-rubygem-foreman_templates-doc) and
using rpm -qd tfm-rubygem-foreman_templates-doc to find the README. Or
many plugins publish versioned docs at Foreman :: Plugin Manuals.

··· On 11/10/16 02:44, Stefan Lasiewski wrote: > I'm running CentOS 6 with SCL, and we're still on Foreman 1.11. > > I'm trying to work with foreman_templates > to update my > templates. I installed foreman_templates a few weeks ago using > `foreman-installer` and I thought it was working then. > > However, when I run certain foreman-installer tasks, I get errors about > 'Don't know how to build task', and others. I get essentially the same > error inside and outside of the TFM SCL environment. > > I'm not very experienced with foreman-rake. Any idea what's going on? > > > > [root@puppet ~]# foreman-rake templates:purge > rake aborted! > Don't know how to build task 'templates:purge'


Dominic Cleal
dominic@cleal.org

Ah, I see. I'm running 2.1.0:

# foreman-rake plugin:list
...
Foreman plugin: foreman_templates, 2.1.0, Greg Sutcliffe, Engine to
synchronise provisioning templates from GitHub

The templates:purge command was added just over a month ago, and the
documentation is available in an older version of
https://github.com/theforeman/foreman_templates.

I was able to get the correct version of my templates by specifying the
correct foreman branch, like this:

foreman-rake templates:sync branch=1.11-stable

I was expecting foreman-rake templates:sync to sync to the 1.11-stable
branch, but instead appears to sync to a newer version instead, and those
templates are not compatible with 1.11.

Thanks for the help.

-= Stefan

··· On Tue, Oct 11, 2016 at 12:08 AM, Dominic Cleal wrote:

On 11/10/16 02:44, Stefan Lasiewski wrote:

[root@puppet ~]# foreman-rake templates:purge
rake aborted!
Don’t know how to build task ‘templates:purge’

It’s unlikely that the version you have installed contains this feature.
It appears to be in version 3.0.0, but it was released for Foreman 1.12
and higher. You can check your version from the About page or by running
foreman-rake plugin:list.


Stefan Lasiewski Email: stefanl@nersc.gov
Computer System Engineer III Email: slasiewski@lbl.gov
NERSC Data Infrastructure Group

National Energy Research Scientific Computing Center (NERSC
http://nersc.gov)
Lawrence Berkeley National Laboratory

>
> The templates:purge command was added just over a month ago, and the
> documentation is available in an older version of
> https://github.com/theforeman/foreman_templates.
>

The master branch README always points to the latest version. If you
switch to the README for your version (
https://github.com/theforeman/foreman_templates/tree/2.1.0) then it should
be correct.

I was able to get the correct version of my templates by specifying the
> correct foreman branch, like this:
>
> foreman-rake templates:sync branch=1.11-stable
>
> I was expecting foreman-rake templates:sync to sync to the 1.11-stable
> branch, but instead appears to sync to a newer version instead, and those
> templates are not compatible with 1.11.
>

The plugin should correctly determine your version and sync the right
branch - I'm surprised that it didn't. If you wan't to debug it further, or
if it continues to happen, let me know.

Greg

··· On 11 October 2016 at 19:25, Stefan Lasiewski wrote:

Thanks Greg. I'll try again after we upgrade to 1.12 or 1.13. If it
continues to happen, I'll post here.

-= Stefan

··· On Wednesday, October 12, 2016 at 2:12:42 AM UTC-7, Greg Sutcliffe wrote: > > On 11 October 2016 at 19:25, Stefan Lasiewski > wrote: > > I was able to get the correct version of my templates by specifying the >> correct foreman branch, like this: >> >> foreman-rake templates:sync branch=1.11-stable >> >> I was expecting `foreman-rake templates:sync` to sync to the >> `1.11-stable` branch, but instead appears to sync to a newer version >> instead, and those templates are not compatible with 1.11. >> > > The plugin should correctly determine your version and sync the right > branch - I'm surprised that it didn't. If you wan't to debug it further, or > if it continues to happen, let me know. >