dbuscrontab: config file argument is accepted by all actions
authorKonstantin Stepanov <kstep@p-nut.info>
Wed, 22 Dec 2010 13:55:47 +0000 (15:55 +0200)
committerKonstantin Stepanov <kstep@p-nut.info>
Wed, 22 Dec 2010 13:55:47 +0000 (15:55 +0200)
dbuscron/shell/edit.py

index e47dcc0..0f41a48 100644 (file)
@@ -1,6 +1,5 @@
 
 import os, sys, shutil, signal, tempfile, pipes
-conffile = '/etc/dbuscrontab'
 pidfile = '/var/run/dbuscron.pid'
 
 from dbuscron.parser import CrontabParser, CrontabParserError
@@ -56,11 +55,12 @@ def run():
         action = None
 
     try:
-        if action == '-e':
+        conffile = sys.argv[2]
+    except IndexError:
+        conffile = '/etc/dbuscrontab'
 
-            # 0. get custom config file to edit
-            if len(sys.argv) > 2:
-                conffile = sys.argv[2]
+    try:
+        if action == '-e':
 
             # 1. create temporary config file copy
             temp_file = create_temp_file(conffile)