Skip to content

Commit 349bc17

Browse files
authored
Merge pull request #107 from marcdemz/feature/WIN-230
Set DeviceName to Environment.MachineName
2 parents d15ed87 + 86e1f10 commit 349bc17

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

Src/StackifyLib/Models/EnvironmentDetail.cs

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -115,23 +115,17 @@ public static string GetDeviceName()
115115
return deviceName.Substring(0, deviceName.Length > 60 ? 60 : deviceName.Length);
116116
}
117117

118+
//WIN-230 - Set DeviceName to Environment.MachineName.
118119
deviceName = Environment.MachineName;
119120

120-
if (AzureConfig.InAzure && ((AzureConfig.IsWebsite) || (AzureConfig.InAzure && Environment.MachineName.StartsWith("RD"))))
121-
{
122-
deviceName = AzureConfig.AzureInstanceName;
123-
}
124-
else
125-
{
126-
var isDefaultDeviceNameEc2 = IsEc2MachineName(deviceName);
121+
var isDefaultDeviceNameEc2 = IsEc2MachineName(deviceName);
127122

128-
if (Config.IsEc2 == null || Config.IsEc2 == true || isDefaultDeviceNameEc2)
123+
if (Config.IsEc2 == null || Config.IsEc2 == true || isDefaultDeviceNameEc2)
124+
{
125+
var instanceID_task = GetEC2InstanceId();
126+
if (string.IsNullOrWhiteSpace(instanceID_task) == false)
129127
{
130-
var ec2InstanceId = GetEC2InstanceId();
131-
if (string.IsNullOrWhiteSpace(ec2InstanceId) == false)
132-
{
133-
deviceName = ec2InstanceId;
134-
}
128+
deviceName = instanceID_task;
135129
}
136130
}
137131

@@ -206,24 +200,18 @@ public static string GetDeviceName()
206200
return deviceName.Substring(0, deviceName.Length > 60 ? 60 : deviceName.Length);
207201
}
208202

203+
//WIN-230 - Set DeviceName to Environment.MachineName.
209204
deviceName = Environment.MachineName;
210205

211-
if (AzureConfig.InAzure && ((AzureConfig.IsWebsite) || (AzureConfig.InAzure && Environment.MachineName.StartsWith("RD"))))
212-
{
213-
deviceName = AzureConfig.AzureInstanceName;
214-
}
215-
else
216-
{
217-
var isDefaultDeviceNameEc2 = IsEc2MachineName(deviceName);
206+
var isDefaultDeviceNameEc2 = IsEc2MachineName(deviceName);
218207

219-
if (Config.IsEc2 == null || Config.IsEc2 == true || isDefaultDeviceNameEc2)
208+
if (Config.IsEc2 == null || Config.IsEc2 == true || isDefaultDeviceNameEc2)
209+
{
210+
var instanceID_task = GetEC2InstanceId();
211+
instanceID_task.Wait();
212+
if (string.IsNullOrWhiteSpace(instanceID_task.Result) == false)
220213
{
221-
var instanceID_task = GetEC2InstanceId();
222-
instanceID_task.Wait();
223-
if (string.IsNullOrWhiteSpace(instanceID_task.Result) == false)
224-
{
225-
deviceName = instanceID_task.Result;
226-
}
214+
deviceName = instanceID_task.Result;
227215
}
228216
}
229217

0 commit comments

Comments
 (0)