Skip to content

Commit a5a1657

Browse files
committed
make conf file optional
1 parent 80ad81f commit a5a1657

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

deploy-agent/deployd/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def main():
340340
parser = argparse.ArgumentParser(description=__doc__)
341341
parser.add_argument('-e', '--server_stage', dest='stage', default='prod',
342342
help="This option is deprecated")
343-
parser.add_argument('-f', '--config-file', dest='config_file', required=False, default='deployd/conf/agent.conf',
343+
parser.add_argument('-f', '--config-file', dest='config_file', required=False,
344344
help="the deploy agent config file path.")
345345
parser.add_argument('-d', '--daemon', dest="daemon", action='store_true')
346346
parser.add_argument('-n', '--host_name', dest="hostname", required=False, default=None)

deploy-agent/deployd/common/config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,19 @@ def __init__(self, filenames=None, config_reader=None):
3535
self._config_reader = config_reader
3636
return
3737

38+
self._config_reader = SafeConfigParser()
39+
if not filenames:
40+
return
41+
3842
if not os.path.exists(filenames):
3943
print('Cannot find config files: {}'.format(filenames))
4044
exit_abruptly(1)
4145

4246
self._filenames = filenames
43-
self._config_reader = SafeConfigParser()
4447
loaded_filenames = self._config_reader.read(self._filenames)
4548
if len(loaded_filenames) == 0:
4649
print('Cannot read config files: {}'.format(self._filenames))
50+
exit_abruptly(1)
4751

4852
def get_config_filename(self):
4953
return self._filenames

0 commit comments

Comments
 (0)