Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #3
0
        public bool UseWindows()
        {
            if (Scope == EngineScopeType.Windows)
            {
                return(true);
            }

            var success = SwitchToScope(EngineScopeType.Windows);

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

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

            var success = SwitchToScope(EngineScopeType.Linux);

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

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