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

dbpath_fix find command issue #571

Open
pavloos opened this issue Dec 30, 2019 · 0 comments
Open

dbpath_fix find command issue #571

pavloos opened this issue Dec 30, 2019 · 0 comments

Comments

@pavloos
Copy link

pavloos commented Dec 30, 2019

Affected Puppet, Ruby, OS and module versions/distributions

It is not puppet related

How to reproduce (e.g Puppet code you use)

set dbpath_fix to true

  class { '::mongodb::server':
    dbpath_fix     => true,
  }

What are you seeing

dbpath ownership is not properly updated. The reason is the order of switches in the command used here https://github.com/voxpupuli/puppet-mongodb/blob/master/manifests/server/config.pp#L139

onlyif    => "find ${dbpath} -not -user ${user} -o -not -group ${group} -print -quit | grep -q '.*'",

above command is not working properly, consider below output

root@8e8583b9f092:/# tree -ug mongodb/
mongodb/
`-- [root     root    ]  1
    `-- [root     root    ]  2
        `-- [root     root    ]  3

3 directories, 0 files

In order to fix those permissions we need find command to return 0, but it returns 1 instead:

root@8e8583b9f092:/# find mongodb/ -not -user mongod -o -not -group mongod -print -quit | grep -q '.*'; echo $?
1

What behaviour did you expect instead

find command to return 0 whenever it should:

root@8e8583b9f092:/# tree -ug mongodb/
mongodb/
`-- [root     root    ]  1
    `-- [root     root    ]  2
        `-- [root     root    ]  3

3 directories, 0 files
root@8e8583b9f092:/# find mongodb/ -print -not -user mongod -o -not -group mongod -quit | grep -q '.*'; echo $?
0
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

Successfully merging a pull request may close this issue.

1 participant