From 9c0beaa0ff1b991b18d02e3a0c83a09ece2e9829 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Sat, 27 Jul 2013 17:50:35 -0700 Subject: [PATCH] fix pylint problems in modules.win_autoruns --- salt/modules/win_autoruns.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/salt/modules/win_autoruns.py b/salt/modules/win_autoruns.py index 2850b82057..cc788e81e7 100644 --- a/salt/modules/win_autoruns.py +++ b/salt/modules/win_autoruns.py @@ -10,6 +10,12 @@ import os import salt.utils +# Define a function alias in order not to shadow built-in's +__func_alias__ = { + 'list_': 'list' +} + + def __virtual__(): ''' Only works on Windows systems @@ -20,7 +26,7 @@ def __virtual__(): return False -def list(): +def list_(): ''' Get a list of automatically running programs @@ -29,12 +35,11 @@ def list(): salt '*' autoruns.list ''' autoruns = {} - curr = None # Find autoruns in registry - keys = ['HKLM\Software\Microsoft\Windows\CurrentVersion\Run',\ - 'HKLM\Software\Microsoft\Windows\CurrentVersion\Run /reg:64',\ - 'HKCU\Software\Microsoft\Windows\CurrentVersion\Run'\ + keys = ['HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', + 'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /reg:64', + 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run' ] winver = __grains__['osfullname'] for key in keys: @@ -47,11 +52,11 @@ def list(): # Find autoruns in user's startup folder if '7' in winver: - user_dir = 'C:\Users\\' - startup_dir = '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup' + user_dir = 'C:\\Users\\' + startup_dir = '\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup' else: - user_dir = 'C:\Documents and Settings\\' - startup_dir = '\Start Menu\Programs\Startup' + user_dir = 'C:\\Documents and Settings\\' + startup_dir = '\\Start Menu\\Programs\\Startup' for user in os.listdir(user_dir): try: @@ -60,7 +65,7 @@ def list(): autoruns[full_dir] = [] for afile in files: autoruns[full_dir].append(afile) - except: + except Exception: pass return autoruns