mirror of https://github.com/Aidaho12/haproxy-wi
				
				
				
			Add ability to test the configuration without saving
							parent
							
								
									ad38eb5305
								
							
						
					
					
						commit
						4fc0e9fa73
					
				|  | @ -343,7 +343,9 @@ def upload_and_restart(serv, cfg, **kwargs): | |||
| 		else: | ||||
| 			commands = [ "sudo mv -f " + tmp_file + " /etc/keepalived/keepalived.conf && sudo systemctl restart keepalived" ] | ||||
| 	else: | ||||
| 		if kwargs.get("just_save") == "save": | ||||
| 		if kwargs.get("just_save") == "test": | ||||
| 			commands = [ "sudo haproxy  -q -c -f " + tmp_file + "&& sudo rm -f " + tmp_file ] | ||||
| 		elif kwargs.get("just_save") == "save": | ||||
| 			commands = [ "sudo haproxy  -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') ] | ||||
| 		else: | ||||
| 			commands = [ "sudo haproxy  -q -c -f " + tmp_file + "&& sudo mv -f " + tmp_file + " " + sql.get_setting('haproxy_config_path') + " && sudo " + sql.get_setting('restart_command') ]	 | ||||
|  |  | |||
|  | @ -60,6 +60,7 @@ | |||
| 					<input type="hidden" value="{{ cfg }}.old" name="oldconfig">  | ||||
| 					<textarea name="config" class="config" rows="35" cols="100">{{ config }}</textarea>  | ||||
| 					<p> | ||||
| 						<button type="submit" value="test" name="save" class="btn btn-default">Just test</button> | ||||
| 						<button type="submit" value="save" name="save" class="btn btn-default">Just save</button> | ||||
| 						<button type="submit" value="" name="" class="btn btn-default">Save and restart</button> | ||||
| 					</p> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Miguel Alexandre
						Miguel Alexandre