示例#1
0
        private bool SwitchToScope(EngineScopeType scope)
        {
            if (scope == EngineScopeType.Linux)
            {
                var result = _host.LinuxDaemon(_certificates);
                return(null != result && result.Success);
            }

            var res = _host.WindowsDaemon(_certificates);

            return(null != res && res.Success);
        }
示例#2
0
        internal EngineScope(DockerUri host, EngineScopeType scope, ICertificatePaths certificates = null)
        {
            Scope         = scope;
            _host         = host;
            _certificates = certificates;

            _original = host.IsWindowsEngine(certificates) ? EngineScopeType.Windows : EngineScopeType.Linux;

            if (scope == _original)
            {
                return;
            }

            SwitchToScope(Scope);
        }
示例#3
0
        public bool UseWindows()
        {
            if (Scope == EngineScopeType.Windows)
            {
                return(true);
            }

            var success = SwitchToScope(EngineScopeType.Windows);

            if (success)
            {
                Scope = EngineScopeType.Windows;
            }

            return(success);
        }
示例#4
0
        public bool UseLinux()
        {
            if (Scope == EngineScopeType.Linux)
            {
                return(true);
            }

            var success = SwitchToScope(EngineScopeType.Linux);

            if (success)
            {
                Scope = EngineScopeType.Linux;
            }

            return(success);
        }
示例#5
0
 public static IEngineScope EngineScope(EngineScopeType scope, DockerUri host = null, ICertificatePaths certificates = null)
 {
     return(new EngineScope(host, scope, certificates));
 }