Beispiel #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();
 }
Beispiel #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();
        }
Beispiel #3
0
        /// <summary>
        /// Less common options
        /// </summary>
        private async Task ExtraMenu()
        {
            var options = new List <Choice <Func <Task> > >
            {
                Choice.Create <Func <Task> >(
                    () => _renewalManager.CancelRenewal(RunLevel.Interactive),
                    "Cancel scheduled renewal", "C"),
                Choice.Create <Func <Task> >(
                    () => _renewalManager.CancelAllRenewals(),
                    "Cancel *all* scheduled renewals", "X"),
                Choice.Create <Func <Task> >(
                    () => RevokeCertificate(),
                    "Revoke certificate", "V"),
                Choice.Create <Func <Task> >(
                    () => _taskScheduler.EnsureTaskScheduler(RunLevel.Interactive | RunLevel.Advanced, true),
                    "(Re)create scheduled task", "T",
                    disabled: !_userRoleService.AllowTaskScheduler),
                Choice.Create <Func <Task> >(
                    () => _container.Resolve <EmailClient>().Test(),
                    "Test email notification", "E"),
                Choice.Create <Func <Task> >(
                    () => UpdateAccount(RunLevel.Interactive),
                    "ACME account details", "A"),
                Choice.Create <Func <Task> >(
                    () => Import(RunLevel.Interactive | RunLevel.Advanced),
                    "Import scheduled renewals from WACS/LEWS 1.9.x", "I",
                    disabled: !_userRoleService.IsAdmin),
                Choice.Create <Func <Task> >(
                    () => Encrypt(RunLevel.Interactive),
                    "Encrypt/decrypt configuration", "M"),
                Choice.Create <Func <Task> >(
                    () => Task.CompletedTask,
                    "Back", "Q",
                    @default: true)
            };
            var chosen = await _input.ChooseFromMenu("Please choose from the menu", options);

            await chosen.Invoke();
        }
Beispiel #4
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}'.");
        }