python wants all commands to be a list

This resolves an error with pythons subprocess module, where it expects
a list of command line arguments.
This commit is contained in:
Gibheer 2020-02-27 19:01:55 +01:00
parent 29927fd050
commit 6c2e5ff1d8
1 changed files with 3 additions and 3 deletions

View File

@ -55,14 +55,14 @@ if __name__ == "__main__":
sys.exit(-1)
if update['action'] == 'create_zone' and config.has_option('command', 'add_zone'):
command = config.get('command', 'add_zone') % (update['zone_name'])
subprocess.call(command)
subprocess.call(command.split(' '))
elif update['action'] != 'create_zone' and config.has_option('command', 'reload_zone'):
command = config.get('command', 'reload_zone') % (update['zone_name'])
subprocess.call(command)
subprocess.call(command.split(' '))
elif update['action'] == 'delete_zone':
os.remove(filepath)
if config.has_option('command', 'del_zone'):
command = config.get('command', 'del_zone') % (update['zone_name'])
subprocess.call(command)
subprocess.call(command.split(' '))
c.output_update_delete([update['id']])