Projet

Général

Profil

Révision 646a6c69

ID646a6c698595658de41cc0684eabce06eeb43657
Parent d5caa85c
Enfant 81833d05

Ajouté par Neraud il y a plus de 7 ans

Fixed user detection.
The USER environment variable is not populated when the plugin is executed. Switched to checking the effective user.

Voir les différences:

plugins/git/git_commit_behind
114 114
import logging
115 115
import os
116 116
from pathlib import Path
117
import pwd
117 118
from random import randint
118 119
import re
119 120
from shlex import quote
......
128 129
    logging.basicConfig(level=logging.DEBUG,
129 130
                        format='%(asctime)s %(levelname)-7s %(message)s')
130 131

  
132
current_user = pwd.getpwuid(os.geteuid())[0]
133

  
131 134
conf = {
132 135
    'git_path':            os.getenv('git_path', '/usr/bin/git'),
133 136
    'state_file':          os.getenv('MUNIN_STATEFILE'),
......
170 173

  
171 174

  
172 175
def generate_git_command(repo_conf, git_command):
173
    if not repo_conf['user'] or repo_conf['user'] == os.environ['USER']:
176
    if not repo_conf['user'] or repo_conf['user'] == current_user:
174 177
        cmd = [quote(conf['git_path'])] + git_command
175 178
    else:
176 179
        shell_cmd = 'cd %s ; %s %s' % (

Formats disponibles : Unified diff