Exemple #1
0
        protected override void Run()
        {
            // set the password on the storagelink service.
            _storageLinkConnection.SetPassword(_username, _oldPassword, _newPassword);

            foreach (Pool pool in GetPoolsToCheck())
            {
                // set the password on the pool other-config
                StorageLinkCredentials creds = pool.GetStorageLinkCredentials();
                creds.SetPassword(_newPassword);

                foreach (PBD pbd in pool.Connection.Cache.PBDs)
                {
                    creds = pbd.GetStorageLinkCredentials();

                    // set the password on the pbd device-config.
                    if (creds != null &&
                        creds.Host == _storageLinkConnection.Host &&
                        creds.Username == _storageLinkConnection.Username &&
                        creds.Password != null)
                    {
                        creds.SetPassword(_newPassword);
                    }
                }
            }
        }
        protected override void Run()
        {
            if (Connection.IsConnected)
            {
#if DEBUG
                Program.Invoke(Program.MainWindow, () =>
                {
                    // check that local SL creds have been moved to pool.other_config by StorageLinkConnectionManager.
                    Settings.CslgCredentials localCrds = Settings.GetCslgCredentials(Connection);
                    Debug.Assert(localCrds == null || string.IsNullOrEmpty(localCrds.Host));
                });
#endif

                Pool pool = Helpers.GetPoolOfOne(Connection);
                pool.SetStorageLinkCredentials(_host, _username, _password);

                // other-config gets set on event thread.
                // so wait until other-config has been updated.

                WaitForUpdate(pool);

                // force an other-config change event. In case only the value of the secret has changed.
                Program.BeginInvoke(Program.MainWindow, () => pool.NotifyPropertyChanged("other_config"));

                foreach (PBD pbd in Connection.Cache.PBDs)
                {
                    StorageLinkCredentials creds = pbd.GetStorageLinkCredentials();

                    if (creds != null && creds.Host == _host && creds.Username == _username)
                    {
                        creds.SetPassword(_password);
                    }
                }
            }
        }