Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcs auth will fail with false error message if pcsd-cli.rb outputs to stderr #124

Closed
clarkhale opened this issue Jan 11, 2017 · 1 comment

Comments

@clarkhale
Copy link

clarkhale commented Jan 11, 2017

When calling pcs auth, if the call to /usr/lib/pcsd/pcsd-cli.rb produces any output on stderr, then it causes the pcs auth command to succeed, but display a failure message.

This may actually happen in other instances, but pcs auth is where I noticed it.

# pcs cluster auth node1 node2 -u hacluster -p hacluster
Error: Unable to communicate with pcsd

I can reproduce this every time, if I set the permissions on /usr/bin to 777. (I know this should never be done, but it's an easy way to reproduce):

# pcs cluster auth node1 node2 -u hacluster -p hacluster --debug
Running: /usr/bin/ruby -I/usr/lib/pcsd/ /usr/lib/pcsd/pcsd-cli.rb auth
--Debug Input Start--
{"force": false, "username": "hacluster", "nodes": ["node1", "node2"], "local": false, "password": "hacluster"}
--Debug Input End--
Return Value: 0
--Debug Output Start--
/usr/lib/pcsd/bootstrap.rb:58: warning: Insecure world writable dir /usr/bin in PATH, mode 040777
{
  "status": "ok",
  "data": {
    "auth_responses": {
      "node1": {
        "status": "already_authorized"
      },
      "node2": {
        "status": "already_authorized"
      }
    },
    "sync_successful": true,
    "sync_nodes_err": [

    ],
    "sync_responses": {
    }
  },
  "log": [
    "I, [2017-01-11T15:20:46.059243 #2820]  INFO -- : PCSD Debugging enabled\n",
    "D, [2017-01-11T15:20:46.059291 #2820] DEBUG -- : Did not detect RHEL 6\n",
    "I, [2017-01-11T15:20:46.059311 #2820]  INFO -- : Running: /usr/sbin/corosync-cmapctl totem.cluster_name\n",
    "I, [2017-01-11T15:20:46.059323 #2820]  INFO -- : CIB USER: hacluster, groups: \n",
    "D, [2017-01-11T15:20:46.060963 #2820] DEBUG -- : []\n",
    "D, [2017-01-11T15:20:46.061003 #2820] DEBUG -- : [\"Failed to initialize the cmap API. Error CS_ERR_LIBRARY\\n\"]\n",
    "D, [2017-01-11T15:20:46.061026 #2820] DEBUG -- : Duration: 0.001633262s\n",
    "I, [2017-01-11T15:20:46.061055 #2820]  INFO -- : Return Value: 1\n",
    "W, [2017-01-11T15:20:46.061093 #2820]  WARN -- : Cannot read config 'corosync.conf' from '/etc/corosync/corosync.conf': No such file\n",
    "W, [2017-01-11T15:20:46.061142 #2820]  WARN -- : Cannot read config 'corosync.conf' from '/etc/corosync/corosync.conf': No such file or directory - /etc/corosync/corosync.conf\n",
    "I, [2017-01-11T15:20:46.061461 #2820]  INFO -- : SRWT Node: node2 Request: check_auth\n",
    "I, [2017-01-11T15:20:46.062706 #2820]  INFO -- : SRWT Node: node1 Request: check_auth\n"
  ]
}
--Debug Output End--

Error: Unable to communicate with pcsd

The line:

/usr/lib/pcsd/bootstrap.rb:58: warning: Insecure world writable dir /usr/bin in PATH, mode 040777

Contaminates the output, and renders the JSON unparseable. This causes the pcs command to look like it's failed, even though the action was successful.

@tomjelinek
Copy link
Member

Thank you for the detailed report. This issue is fixed in 03f17f8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants