Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cherry-pick] Fix Civil3D hostname to fix psuedo warning for package users (#13910) #13935

Merged
merged 1 commit into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/DynamoPackages/PackageManagerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class PackageManagerClient
#region Properties/Fields

public const string PackageEngineName = "dynamo";
private IEnumerable<string> cachedHosts;

// These were used early on in order to identify packages with binaries and python scripts
// This is now a bona fide field in the DB so they are obsolete.
Expand Down Expand Up @@ -179,12 +180,16 @@ internal virtual PackageVersion GetPackageVersionHeader(string id, string versio
/// </summary>
internal virtual IEnumerable<string> GetKnownHosts()
{
return FailFunc.TryExecute(() =>
if (cachedHosts == null)
{
var hosts = new Hosts();
var hostsResponse = this.client.ExecuteAndDeserializeWithContent<List<String>>(hosts);
return hostsResponse.content;
}, new List<string>());
cachedHosts = FailFunc.TryExecute(() =>
{
var hosts = new Hosts();
var hostsResponse = this.client.ExecuteAndDeserializeWithContent<List<String>>(hosts);
return hostsResponse.content;
}, new List<string>());
}
return cachedHosts;
}

internal bool GetTermsOfUseAcceptanceStatus()
Expand Down
7 changes: 3 additions & 4 deletions src/DynamoPackages/PackageManagerExtension.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using Dynamo.Configuration;
using Dynamo.Extensions;
using Dynamo.Graph.Workspaces;
using Dynamo.Interfaces;
Expand Down Expand Up @@ -357,7 +355,8 @@ internal bool CheckIfPackagesTargetOtherHosts(IEnumerable<PackageVersion> newPac
{
// Is our host in the list?
// If not, is any other host in the list?
return x.host_dependencies != null && !x.host_dependencies.Contains(Host) && otherHosts.Any(y => x.host_dependencies.Contains(y));
// Also, check if any dependency contains the hostname or vice-versa.
return x.host_dependencies != null && !x.host_dependencies.Contains(Host) && !x.host_dependencies.Any(y => Host.Contains(y)) && otherHosts.Any(y => x.host_dependencies.Contains(y));
});
}

Expand Down