Example #1
0
 public void Import()
 {
     _log.Information("Legacy renewals {x}", _legacyRenewal.Renewals.Count().ToString());
     _log.Information("Current renewals {x}", _currentRenewal.Renewals.Count().ToString());
     foreach (LegacyScheduledRenewal legacyRenewal in _legacyRenewal.Renewals)
     {
         var converted = Convert(legacyRenewal);
         _currentRenewal.Import(converted);
     }
     _currentTaskScheduler.EnsureTaskScheduler();
     _legacyTaskScheduler.StopTaskScheduler();
 }
Example #2
0
        public async Task Import()
        {
            _log.Information("Legacy renewals {x}", _legacyRenewal.Renewals.Count().ToString());
            _log.Information("Current renewals {x}", _currentRenewal.Renewals.Count().ToString());
            foreach (var legacyRenewal in _legacyRenewal.Renewals)
            {
                var converted = Convert(legacyRenewal);
                _currentRenewal.Import(converted);
            }
            await _currentTaskScheduler.EnsureTaskScheduler(RunLevel.Import);

            _legacyTaskScheduler.StopTaskScheduler();
        }
Example #3
0
        public async Task Import(RunLevel runLevel)
        {
            if (!_legacyRenewal.Renewals.Any())
            {
                _log.Warning("No legacy renewals found");
            }
            _log.Information("Legacy renewals {x}", _legacyRenewal.Renewals.Count().ToString());
            _log.Information("Current renewals {x}", _currentRenewal.Renewals.Count().ToString());
            _log.Information("Step {x}/3: convert renewals", 1);
            foreach (var legacyRenewal in _legacyRenewal.Renewals)
            {
                var converted = Convert(legacyRenewal);
                _currentRenewal.Import(converted);
            }
            _log.Information("Step {x}/3: create new scheduled task", 2);
            await _currentTaskScheduler.EnsureTaskScheduler(runLevel | RunLevel.Import, true);

            _legacyTaskScheduler.StopTaskScheduler();

            _log.Information("Step {x}/3: ensure ACMEv2 account", 3);
            await _acmeClient.GetAccount();

            var listCommand  = "--list";
            var renewCommand = "--renew";

            if (runLevel.HasFlag(RunLevel.Interactive))
            {
                listCommand  = "Manage renewals";
                renewCommand = "Run";
            }
            _input.CreateSpace();
            _input.Show(null,
                        value: $"The renewals have now been imported into this new version " +
                        "of the program. Nothing else will happen until new scheduled task is " +
                        "first run *or* you trigger them manually. It is highly recommended " +
                        $"to review the imported items with '{listCommand}' and to monitor the " +
                        $"results of the first execution with '{renewCommand}'.");
        }