chef / chef/chef-server

chef-automate running chef-server error with chef-server-ctl grant-server-admin-permissions

Open
#2,514 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: automate integration
Dominant language
Erlang
Stars
303
Forks
211
Avg merge
1d 8h
Merged PRs (30d)
5

Description

We are using an external AWS Aurora postgres database and that is working fine except for this one command chef-server-ctl grant-server-admin-permissions, which seems to be trying to connect to the database using the local 127.0.0.1 at port 5432. Perhaps there is a bug in this command that is not using a parameter it should to find the external database. This is the command and error message

[root@chef-dev ~]# chef-server-ctl grant-server-admin-permissions test-user
/hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/vendor/bundle/gems/bundler-1.17.2/lib/bundler/rubygems_integration.rb:200: warning: constant Gem::ConfigMap is deprecated
bundler: failed to load command: /hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/binstubs/chef-server-ctl (/hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/binstubs/chef-server-ctl)
PG::ConnectionBad: could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
/hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/plugins/server_admins.rb:147:in initialize' /hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/plugins/server_admins.rb:147:in new'
/hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/plugins/server_admins.rb:147:in setup_erchef_db' /hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/plugins/server_admins.rb:34:in block in load_file'
/hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/vendor/bundle/ruby/2.6.0/bundler/gems/omnibus-ctl-c82dbb47b738/lib/omnibus-ctl.rb:204:in block in add_command_under_category' /hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/vendor/bundle/ruby/2.6.0/bundler/gems/omnibus-ctl-c82dbb47b738/lib/omnibus-ctl.rb:747:in run'
/hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/bin/chef-server-ctl:299:in <top (required)>' /hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/binstubs/chef-server-ctl:29:in load'
/hab/pkgs/chef/chef-server-ctl/14.1.0/20210225010004/omnibus-ctl/binstubs/chef-server-ctl:29:in `<top (required)>'

To Reproduce

Set up an automate-installed chef infra server with an external AWS Aurora postgres database and run chef-server-ctl grant-server-admin-permissions user

Expected behavior

Command succeeds and user becomes a server admin with data stored in the external database

Actual behavior

Error message indicates attempt to talk to 127.0.0.1:5432 and command faiuls

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with omnibus-ctl/plugins/server_admins.rb, especially setup_erchef_db at line 147, and trace how chef-server-ctl grant-server-admin-permissions obtains database connection settings. Reproduce with an external AWS Aurora PostgreSQL database. Done means the command connects to the configured external database and grants the requested user server-admin permissions.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, postgresql, ruby
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.