Skip to content

fix user and group fact #171

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

Merged
merged 6 commits into from
Oct 16, 2023
Merged

fix user and group fact #171

merged 6 commits into from
Oct 16, 2023

Conversation

Aethenn
Copy link
Contributor

@Aethenn Aethenn commented Oct 16, 2023

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?

  • Tested on my dedicated server

@saltydk
Copy link
Member

saltydk commented Oct 16, 2023

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
Copy link
Member

saltydk commented Oct 16, 2023

What does

stat /etc/passwd

say?

@Aethenn
Copy link
Contributor Author

Aethenn commented Oct 16, 2023

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
Copy link
Member

saltydk commented Oct 16, 2023

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

@Aethenn
Copy link
Contributor Author

Aethenn commented Oct 16, 2023

Like usual : sb install backup

@saltydk
Copy link
Member

saltydk commented Oct 16, 2023

Is your sudo broken?

@saltydk
Copy link
Member

saltydk commented Oct 16, 2023

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

@Aethenn
Copy link
Contributor Author

Aethenn commented Oct 16, 2023

I think not

@saltydk
Copy link
Member

saltydk commented Oct 16, 2023

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

@Aethenn
Copy link
Contributor Author

Aethenn commented Oct 16, 2023

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

@saltydk
Copy link
Member

saltydk commented Oct 16, 2023

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
Copy link
Member

saltydk commented Oct 16, 2023

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 :)

@saltydk saltydk merged commit ad3e007 into saltyorg:master Oct 16, 2023
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 this pull request may close these issues.

2 participants