Пример #1
0
 public StandaloneAdminConfig(
     FabricSettingsMetadata fabricSettingsMetadata,
     StandAloneClusterManifestSettings standAloneClusterManifestSettings,
     AdminConfigVersion version,
     bool isUserSet)
 {
     this.fabricSettingsMetadata = fabricSettingsMetadata;
     this.Version = version;
     this.standAloneClusterManifestSettings = standAloneClusterManifestSettings;
     this.IsUserSet = isUserSet;
 }
Пример #2
0
        public StandaloneAdminConfig(string configurationsFilePath = null, bool isUserSet = false)
        {
            //// Extract Configuration

            string fabricSettingFilePath = string.IsNullOrEmpty(configurationsFilePath)
                                                 ? StandaloneUtility.FindFabricResourceFile(DMConstants.ConfigurationsFileName)
                                                 : configurationsFilePath;

            this.fabricSettingsMetadata = FabricSettingsMetadata.Create(fabricSettingFilePath);
            string clusterSettingsFilePath = this.GetClusterSettingsFilePath();

            // Extract Cluster Settings
            // ReSharper disable once AssignNullToNotNullAttribute - fabric Code Path cannot be null here.
            this.Version = new AdminConfigVersion("Baseline", "Baseline");
            this.standAloneClusterManifestSettings = JsonConvert.DeserializeObject <StandAloneClusterManifestSettings>(
                File.ReadAllText(clusterSettingsFilePath));
            this.IsUserSet = isUserSet;
        }
Пример #3
0
        internal static string GetGoalStateUri()
        {
            string goalStateUriStr = null;

            /* Test code relies on the settings present in ClusterSettings.json for deployment of a specific version.
             * We need this check for the test code because certain APIs will be invoked before the cluster is even up. */
            string clusterSettingsFilepath = StandaloneUtility.FindFabricResourceFile(DMConstants.ClusterSettingsFileName);

            if (!string.IsNullOrEmpty(clusterSettingsFilepath))
            {
                StandAloneClusterManifestSettings standAloneClusterManifestSettings = JsonConvert.DeserializeObject <StandAloneClusterManifestSettings>(File.ReadAllText(clusterSettingsFilepath));
                if (standAloneClusterManifestSettings.CommonClusterSettings != null && standAloneClusterManifestSettings.CommonClusterSettings.Section != null)
                {
                    SettingsTypeSection settings = standAloneClusterManifestSettings.CommonClusterSettings.Section.ToList().SingleOrDefault(
                        section => section.Name == DMConstants.UpgradeOrchestrationServiceConfigSectionName);
                    if (settings != null)
                    {
                        SettingsTypeSectionParameter goalStatePathParam = settings.Parameter.ToList().SingleOrDefault(param => param.Name == DMConstants.GoalStateFileUrlName);
                        if (goalStatePathParam != null)
                        {
                            goalStateUriStr = goalStatePathParam.Value;
                        }
                    }
                }
            }

            // Check the native config store before using default location. The GoalStateFileUrl may have been overridden by the user.
            if (string.IsNullOrEmpty(goalStateUriStr))
            {
                NativeConfigStore configStore = NativeConfigStore.FabricGetConfigStore();
                goalStateUriStr = configStore.ReadUnencryptedString(DMConstants.UpgradeOrchestrationServiceConfigSectionName, DMConstants.GoalStateFileUrlName);
            }

            if (string.IsNullOrEmpty(goalStateUriStr))
            {
                goalStateUriStr = DMConstants.DefaultGoalStateFileUrl;
            }

            return(goalStateUriStr);
        }