Skip to content

[Bug]: postgres module doesn't respect configuration #69971

Description

@nicholas-rees

What happened?

A bug happened!

the postgres execution module says it respects the following configuration:

configuration:
In order to connect to Postgres, certain configuration is required in /etc/salt/minion on the relevant minions. Some sample configs might look like:

postgres.host: 'localhost'
postgres.port: '5432'
postgres.user: 'postgres' -> db user
postgres.pass: ''
postgres.maintenance_db: 'postgres'

The default for the maintenance_db is 'postgres' and in most cases it can be left at the default setting. This data can also be passed into pillar. Options passed into opts will overwrite options passed into pillar

However, it seems like there's an issue with config.option not respecting nesting keys:

# salt-call config.option postgres
local:
    ----------
    host:
        **********
    maintenance_db:
        **********
    pass:
        **********
    port:
        **********
    user:
        **********
# salt-call config.option postgres.user
local:

Yet:

# salt-call config.get postgres
local:
    ----------
    host:
        **********
    maintenance_db:
        **********
    pass:
        **********
    port:
        **********
    user:
        **********
# salt-call config.get postgres:user
local:
    salt_admin

Note that I did try the colon as a delimiter with config.option:

# salt-call config.option postgres:user
local:

I will be opening a PR to make the postgres module use config.get. But you might rather that I fix config.option instead. The docs to config.option explicitly says it doesn't respect nested keys:

# salt-call config.option

Passed invalid arguments: option() missing 1 required positional argument: 'value'.

Usage:

Returns the setting for the specified config value. The priority for
matches is the same as in :py:func:`config.get <salt.modules.config.get>`,
only this function does not recurse into nested data structures. Another
difference between this function and :py:func:`config.get
<salt.modules.config.get>` is that it comes with a set of "sane defaults".
To view these, you can run the following command:

Note that I'm using the bootstrap installer .

Type of salt install

other (please specify in bug details)

Major version

3008.x

What supported OS are you seeing the problem on? Can select multiple. (If bug appears on an unsupported OS, please open a GitHub Discussion instead)

debian-13

salt --versions-report output

salt-call --versions-report
Salt Version:
          Salt: 3008.2

Python Version:
        Python: 3.14.6 (main, Jun 11 2026, 02:19:05) [GCC 11.2.0]

Dependency Versions:
          cffi: 2.0.0
      cherrypy: 18.10.0
  cryptography: 48.0.0
      dateutil: 2.9.0.post0
     docker-py: Not Installed
         gitdb: 4.0.12
     gitpython: Not Installed
        Jinja2: 3.1.6
       libgit2: Not Installed
  looseversion: 1.3.0
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.1.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 24.0
     pycparser: 3.00
      pycrypto: Not Installed
  pycryptodome: 3.23.0
        pygit2: Not Installed
  python-gnupg: 0.5.6
        PyYAML: 6.0.3
         PyZMQ: 27.1.0
        relenv: 0.22.14
         smmap: 5.0.2
       timelib: 0.3.0
       Tornado: 6.5.7
           ZMQ: 4.3.5

Salt Extensions:
 saltext.vault: 1.7.0

Salt Package Information:
  Package Type: onedir

System Versions:
          dist: debian 13.6 trixie
        locale: utf-8
       machine: x86_64
       release: 7.1.5-arch1-1
        system: Linux
       version: Debian GNU/Linux 13.6 trixie

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbroken, incorrect, or confusing behaviorneeds-triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions