Project

General

Profile

Actions

Bug #28948

closed

service commands break on pulp3 box when /etc/pulp/settings.py isn't formatted correctly

Added by John Mitsch about 4 years ago. Updated 2 months ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Currently this is breaking in a dev box:

[vagrant@centos7-katello-devel-stable foreman_maintain{master}]$ foreman_maintain_scl service status
Running Status Services
================================================================================
Get status of applicable services:

Displaying the following service(s):                                  [FAIL]
undefined method `+' for nil:NilClass
--------------------------------------------------------------------------------
Scenario [Status Services] failed.

The following steps ended up in failing state:

  [service-status]

Resolve the failed steps and rerun
the command. In case the failures are false positives,
use --whitelist="service-status" 

Foreman-maintain reads from /etc/pulp/settings.py (PULPCORE_DB_CONFIG variable here) https://github.com/theforeman/foreman_maintain/blob/master/definitions/features/pulpcore_database.rb def load_configuration
full_config = File.read(PULPCORE_DB_CONFIG).split(/[\s,':]/).reject(&:empty?) @configuration = {}
@configuration['adapter'] = 'postgresql'
@configuration['host'] = full_config[full_config.index('HOST') + 1]
@configuration['port'] = full_config[full_config.index('PORT') + 1]
@configuration['database'] = full_config[full_config.index('NAME') + 1]
@configuration['username'] = full_config[full_config.index('USER') + 1]
@configuration['password'] = full_config[full_config.index('PASSWORD') + 1]
@configuration
end

In /etc/pulp/settings.py, this info is in `DATABASES` on a single line
[vagrant@centos7-katello-devel-stable foreman_maintain{master}]$ sudo cat /etc/pulp/settings.py
DATABASES = {"default": {"HOST": "localhost", "ENGINE": "django.db.backends.postgresql_psycopg2", "NAME": "pulp", "USER": "pulp", "PASSWORD": "pulp", "PORT": 7878}}
SECRET_KEY = "secret"
CONTENT_ORIGIN = "centos7-katello-devel-stable.example.com"
TOKEN_AUTH_DISABLED = True
REMOTE_USER_ENVIRON_NAME = "HTTP_REMOTE_USER"
ANSIBLE_API_HOSTNAME = "centos7-katello-devel-stable.example.com"
ANSIBLE_CONTENT_HOSTNAME = "https://centos7-katello-devel-stable.example.com/pulp_ansible/content/"
PULP2_MONGODB = {"name": "pulp_database", "seeds": "localhost:27017"}

There is a workaround for a more forgiving way to parse a config file by changing the `split` method to be `split(/[\s,'":]/)` in pulpcore_database.rb

Ideally we figure out a more robust way of parsing the file or convert it into a parseable format

Actions #1

Updated by John Mitsch about 4 years ago

  • Description updated (diff)
Actions #2

Updated by The Foreman Bot about 4 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to John Mitsch
  • Pull request https://github.com/theforeman/foreman_maintain/pull/314 added
Actions #3

Updated by Eric Helms 2 months ago

  • Status changed from Ready For Testing to Rejected
Actions

Also available in: Atom PDF