Project

General

Profile

Actions

Bug #9101

closed

After dropping Foreman database, cannot re-run installer successfully

Added by Eric Helms over 9 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Foreman modules
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Scenario:

1. Install Foreman 1.7
2. Decide you want to re-install or reset data
3. run 'foreman-rake db:drop'
4. run 'foreman-installer'
5. Get error

This also manifests itself within the katello-installer and is blocking our ability to reset all data. The user ends up in an entirely broken state if they try to use our --reset flag that includes the above scenario. From my investigations the error appears to revolve around the fact that after dropping the database, when the installer hits this line:

https://github.com/theforeman/puppet-foreman/blob/master/manifests/database.pp#L24

The following error is thrown by running the command:

foreman_bootdisk: skipping engine hook (PGError: ERROR: relation "template_kinds" does not exist
LINE 4: WHERE a.attrelid = '"template_kinds"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"template_kinds"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
)

The puppet function ends up returning a nil value which Puppet interprets as not needing to propogate further and the migrate and seed are never run. After an unsuccessful run of the above scenario, you will get the same error if you try to run 'foreman-rake console'.

I had a few different ideas on how to solve this but ultimately was unsure if this is an issue with something bootdisk is doing or how the puppet function is interpreting the return when running this command.

Actions

Also available in: Atom PDF