CiscoCloud / distributive

Unit testing for the cloud
Apache License 2.0
147 stars 20 forks source link

UserInGroup errors when validating groups. #120

Closed zahartx closed 8 years ago

zahartx commented 8 years ago

I am encountering an issue when verify users are part of a group. /etc/group only contains secondary group membership in RHEL/CentOS. /etc/passwd contains primary membership.

Test json file

{
    "Name": "User checks",
    "Checklist" : [
    {
        "Check" : "userExists",
        "Parameters" : ["root"]
    },
    {
        "Check" : "userInGroup",
        "Parameters" : ["root", "root"]
    },
    {
        "Check" : "userHasUID",
        "Parameters" : ["root", "0"]
    }

    ]
}

distributive output

distributive -f test.json v=2 Creating checklist... Running checks... Passed: 2 Failed: 1

User not found in group: Specified: root Actual: []

System Information

id root
uid=0(root) gid=0(root) groups=0(root)
groups root
root : root
grep root /etc/group
root:x:0:

Not sure why the check is failing. Searching through the code it appeared this check was parsing /etc/group vs using or validating with ID or groups commands.

langston-barrett commented 8 years ago

Closing as a duplicate of #119