'foremanctl features' was working, then broke after deployment

Problem:

I followed the 3.19 containerized deployment guide at Installing Foreman Server with Katello 4.21 plugin (containerized) on Enterprise Linux. After I initially installed foremanctl from dnf, the foremanctl features command worked… then I did a deployment (which worked) and after the deployment, the features command is broken with this error:

[root@foreman-02 ~]# foremanctl features

TASK [Print features] ************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! =>
msg: |-
The task includes an option with an undefined variable. The error was: {{ (flavor_features + features) }}: ‘flavor_features’ is undefined. ‘flavor_features’ is undefined. {{ (flavor_features + features) }}: ‘flavor_features’ is undefined. ‘flavor_features’ is undefined

    The error appears to be in '/usr/share/foremanctl/src/playbooks/features/features.yaml': line 14, column 7, but may
    be elsewhere in the file depending on the exact syntax problem.

    The offending line appears to be:

      tasks:
        - name: Print features
          ^ here

[root@foreman-02 ~]#

Expected outcome:

foremanctl features would continue to work after deployment (or whatever I may have done to break it).

Foreman and Proxy versions:

[root@foreman-02 ~]# podman images
REPOSITORY                        TAG           IMAGE ID      CREATED        SIZE
quay.io/sclorg/postgresql-13-c9s  latest        2c7f99d16e3e  6 days ago     379 MB
quay.io/foreman/foreman           3.19          9c73f94dd101  2 weeks ago    998 MB
quay.io/foreman/candlepin         foreman-3.19  a26764a04788  2 weeks ago    634 MB
quay.io/foreman/pulp              foreman-3.19  1c486fcabfb0  2 weeks ago    650 MB
quay.io/sclorg/redis-6-c9s        latest        c7ac11061bbe  17 months ago  280 MB
[root@foreman-02 ~]# 

Foreman and Proxy plugin versions:

Distribution and version:

Other relevant data:

I figured out what I did that broke it.

I was trying to figure out what --flavor was as a flag, so I passed:

foremanctl deploy --flavor taco

…expecting “taco is not a flavor, try blah blah blah” … but there was no error-checking like that and THAT is what broke it. (at step TASK [Include iop databases] if anyone cares)

I just ran:

foremanctl deploy --flavor katello

and after the ansible run, now it works again:

[root@foreman-02 ~]# foremanctl features
FEATURE                   STATE        DESCRIPTION
foreman                   enabled      Base Foreman Server
hammer                    enabled      Foreman CLI
katello                   enabled      Content and Subscription Management plugin for Foreman
foreman-proxy             available    Base Foreman Proxy
google                    available    Google Compute Engine plugin for Foreman
azure-rm                  available    Azure Resource Manager plugin for Foreman
remote-execution          available    Remote Execution plugin for Foreman
rh-cloud                  available    Connection to Red Hat Cloud
iop                       available    iop services
bmc                       available    Power management for bare metal hosts (IPMI, Redfish)
[root@foreman-02 ~]# 

I’d love to know where my variable of ‘flavor’ got saved if anyone reading this knows. Hopefully this helps someone else.

2 Likes

Answering my own question about where it’s “remembering” the flavor from. Here’s how I got the answer:

[root@foreman-02 ~]# which foremanctl
/usr/bin/foremanctl
[root@foreman-02 ~]# cat /usr/bin/foremanctl | grep ^OBSAH_STATE
OBSAH_STATE=/var/lib/foremanctl
[root@foreman-02 ~]# cat /var/lib/foremanctl/parameters.yaml
features:
- hammer
flavor: katello
foreman_initial_admin_password: changeme
foreman_initial_admin_username: admin
foreman_initial_location: MyCity
foreman_initial_organization: MyOrg
[root@foreman-02 ~]# 

Thanks for catching this!

We’ve implemented a stricter validation of possible flavor values in Set choices for flavor, so users can't select a wrong one by evgeni · Pull Request #559 · theforeman/foremanctl · GitHub

1 Like