saltyorg / Saltbox

Ansible-based solution for rapidly deploying a Docker containerized cloud media server.
https://docs.saltbox.dev
GNU General Public License v3.0
571 stars 65 forks source link

fix user and group fact #171

Closed Aethenn closed 8 months ago

Aethenn commented 8 months ago

Description

After deploying the backup role, i see the Gathering Facts task on the warning. TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************************************************************************** Monday 16 October 2023 23:01:51 +0200 (0:00:00.436) 0:00:00.436 ******** [WARNING]: Failure executing fact script (/srv/git/saltbox/ansible_facts.d/group.fact), rc: 1, err: Traceback (most recent call last): File "/srv/git/saltbox/ansible_facts.d/group.fact", line 6, in <module> file = open("/etc/group", "r+") PermissionError: [Errno 13] Permission denied: '/etc/group' [WARNING]: Failure executing fact script (/srv/git/saltbox/ansible_facts.d/user.fact), rc: 1, err: Traceback (most recent call last): File "/srv/git/saltbox/ansible_facts.d/user.fact", line 6, in <module> file = open("/etc/passwd", "r+") PermissionError: [Errno 13] Permission denied: '/etc/passwd'

After checking the script, I saw the open() function defined with "r+". I set it to "r" and it works.

How Has This Been Tested?

saltydk commented 8 months ago

While our script has no need to write to the file I do wonder why you are having this issue when no one else has.

saltydk commented 8 months ago

What does

stat /etc/passwd

say?

Aethenn commented 8 months ago

Output of stat /etc/passwd : File: /etc/passwd Size: 1552 Blocks: 8 IO Block: 4096 regular file Device: fd02h/64770d Inode: 146605005 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2023-10-16 12:04:46.966350181 +0200 Modify: 2022-03-23 11:37:06.866904770 +0100 Change: 2022-03-23 11:37:06.886904816 +0100 Birth: -

saltydk commented 8 months ago

That looks fine, how are you running the Saltbox command?

Aethenn commented 8 months ago

Like usual : sb install backup

saltydk commented 8 months ago

Is your sudo broken?

saltydk commented 8 months ago

The reason I ask is that sb normally auto elevates to running as root through sudo.

Aethenn commented 8 months ago

I think not

saltydk commented 8 months ago

Well, root has write access and you cannot open it, that would make me worry about other issues here.

Aethenn commented 8 months ago

When i sudo the script manually it works, I'm going to find my problem.

saltydk commented 8 months ago

Write to me on the discord if you are on it. I'll submit my own changes to the script through this PR so you at least get credit for getting me to rewrite the old stuff.

saltydk commented 8 months ago

I've added my own changes to the facts files but you should still find out what caused this as it isn't what is supposed to happen :)