aboutsummaryrefslogtreecommitdiff
path: root/mcwrapper
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2015-11-15 13:39:22 +0100
committerKarel Kočí <cynerd@email.cz>2015-11-15 13:39:22 +0100
commite69c2dcbbfa72d1b9ab10d2f89b4dce5eb0d3e7f (patch)
tree1ac76a6a48c266a8f6dfb80e6e3df1b8adf3f90b /mcwrapper
parentb5f5662853bd42da4268110d9f4d38702441d6be (diff)
downloadmcserver-wrapper-e69c2dcbbfa72d1b9ab10d2f89b4dce5eb0d3e7f.tar.gz
mcserver-wrapper-e69c2dcbbfa72d1b9ab10d2f89b4dce5eb0d3e7f.tar.bz2
mcserver-wrapper-e69c2dcbbfa72d1b9ab10d2f89b4dce5eb0d3e7f.zip
Change configuration check to use if instead exceptions
Diffstat (limited to 'mcwrapper')
-rwxr-xr-xmcwrapper31
1 files changed, 7 insertions, 24 deletions
diff --git a/mcwrapper b/mcwrapper
index 2784305..4c897d3 100755
--- a/mcwrapper
+++ b/mcwrapper
@@ -45,17 +45,9 @@ else: # else load configuration
__set_empty_config__()
# Set additional runtime configuration variables
-try:
- conf.verbose_level
-except AttributeError:
+if not 'verbose_level' in vars(conf):
conf.verbose_level = 0
-try:
- conf.command
-except AttributeError:
- conf.command = []
-try:
- conf.server
-except AttributeError:
+if not 'server' in vars(conf):
conf.server = dict()
#################################################################################
@@ -263,22 +255,13 @@ if __name__ == '__main__':
conf.server[conf.identifier]
vars(conf).update(conf.server[conf.identifier])
except KeyError:
- if conf.verbose_level >= -1:
- sys.exit('Error: No configuration associated with identifier: ' + conf.identifier)
- else:
- sys.exit();
- # Set configurations for server
- try:
- conf.directory
- except AttributeError:
+ sys.exit('Error: No configuration associated with identifier: ' + conf.identifier)
+ # Check configurations for server
+ if not 'directory' in vars(conf):
sys.exit('Missing "directory" config for server ' + conf.identifier)
- try:
- conf.command
- except AttributeError:
+ if not 'command' in vars(conf):
sys.exit('Missing server start command for server ' + conf.identifier)
- try:
- conf.status
- except AttributeError:
+ if not 'status' in vars(conf):
conf.status = '/dev/shm/mcwrapper-' + conf.identifier
# Set inputPipe
global inputPipe