Exemple #1
0
        /// <summary>
        /// Updates Docker on a specific node.
        /// </summary>
        /// <param name="node">The target node.</param>
        /// <param name="stepDelay">The step delay.</param>
        private void UpdateDocker(SshProxy <NodeDefinition> node, TimeSpan stepDelay)
        {
            if (node.GetDockerVersion() >= (SemanticVersion)version)
            {
                return;     // Already updated
            }

            if (node.Metadata.InSwarm)
            {
                node.Status = "swarm: drain services";
                hive.Docker.DrainNode(node.Name);
            }

            node.Status = "run: safe-apt-get update";
            node.SudoCommand("safe-apt-get update");

            node.Status = $"run: safe-apt-get install -yq {dockerPackageUri}";
            node.SudoCommand($"safe-apt-get install -yq {dockerPackageUri}");

            node.Status = $"restart: docker";
            node.SudoCommand("systemctl restart docker");

            if (node.Metadata.InSwarm)
            {
                // Put the node back into ACTIVE mode (from DRAIN).

                node.Status = "swarm: activate";
                hive.Docker.ActivateNode(node.Name);
            }

            node.Status = $"stabilizing ({Program.WaitSeconds}s)";
            Thread.Sleep(TimeSpan.FromSeconds(Program.WaitSeconds));
        }