Ejemplo n.º 1
0
        public HasConfigure.Result <ProviderConfig> Configure(HasConfigure.Input <ProviderConfig> input)
        {
            var result = new HasConfigure.Result <ProviderConfig>();

            _ps = PowerShell.Create();
            _rs = _ps.Runspace;

            return(result);
        }
        public HasConfigure.Result <ProviderConfig> Configure(
            HasConfigure.Input <ProviderConfig> input)
        {
            var result = new HasConfigure.Result <ProviderConfig>();

            LogInput(input);

            _config        = input.Config;
            _effectivePath = _config.Path;
            if (string.IsNullOrEmpty(_effectivePath))
            {
                _log.LogInformation("Resolving KV store path to current directory");
                _effectivePath = Directory.GetCurrentDirectory();
                result.AddWarning("defaulting to local directory, default kv store name");
            }

            if (File.Exists(_effectivePath))
            {
                _fullPath = Path.GetFullPath(_effectivePath);
            }
            else
            {
                _log.LogInformation("Found no existing file");
                if (Directory.Exists(_effectivePath))
                {
                    _log.LogInformation("Found existing directory");
                    _fullPath = Path.GetFullPath(
                        Path.Combine(_effectivePath, DefaultStoreName));
                }
                else
                {
                    _log.LogInformation("Combining current with specified");
                    _fullPath = Path.GetFullPath(
                        Path.Combine(Directory.GetCurrentDirectory(), _effectivePath));
                }
            }

            _log.LogInformation("Resolved full_path to [{full_path}]", _fullPath);

            LogResult(result);

            return(result);
        }