diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-01 18:31:01 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-01 18:31:01 +0200 |
| commit | 6cfa1584d682e3b92236fa34ebd8587332dcb70f (patch) | |
| tree | 68774d3c079360fa20eaeeab78f7e370bbb847b6 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs | |
| parent | 7fba72a44fa184c6c0bbbd0bd1b788863fe12cf0 (diff) | |
| parent | e8c0d909a7a1a1dcfc5620096a37205088ab727f (diff) | |
| download | Tango-6cfa1584d682e3b92236fa34ebd8587332dcb70f.tar.gz Tango-6cfa1584d682e3b92236fa34ebd8587332dcb70f.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 252491669..a3012ffd8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -113,9 +113,16 @@ namespace Tango.PPC.Common.MachineSetup MachineSetupResponse setup_response = null; - using (var http = new ProtoWebClient()) + try { - setup_response = http.Post<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/Synchronization/MachineSetup", request).Result; + using (var http = new ProtoWebClient()) + { + setup_response = http.Post<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/Synchronization/MachineSetup", request).Result; + } + } + catch (Exception ex) + { + throw LogManager.Log(ex, $"An error occurred while trying to contact machine service: {ex.Message}"); } LogManager.Log($"Machine setup response received: {Environment.NewLine}{setup_response.ToJsonString()}"); @@ -178,14 +185,24 @@ namespace Tango.PPC.Common.MachineSetup LogManager.Log($"Synchronizing database '{remote_address}\\{db_name}' => '{localAddress}\\{db_name}'..."); - LogManager.Log("Initializing database manager..."); - DbManager db = DbManager.FromAddressAndName(localAddress, db_name); + LogManager.Log($"Connecting to local database at {localAddress}..."); + DbManager db = DbManager.FromAddress(localAddress); - LogManager.Log("Checking Tango database exists on the local machine..."); + LogManager.Log($"Ensuring {db_name} database exists on the local machine..."); if (!db.Exists(db_name)) { - throw new InvalidProgramException("Database tango does not exists."); + LogManager.Log("Database does not exist. Creating new database..."); + db.Create(db_name); } + else + { + LogManager.Log("Database exists."); + } + + db.Dispose(); + + LogManager.Log("Initializing database manager..."); + db = DbManager.FromAddressAndName(localAddress, db_name); LogManager.Log("Clearing database..."); db.ClearDb(); |
