Ejemplo n.º 1
0
        public object Bootstrap(Drone drone)
        {
            using (var ssh = new SshClient(ChefHost, "root", "0953acb"))
            {
                ssh.Connect();
                var cmd = ssh.RunCommand(string.Format("knife bootstrap {0} -x root -P 0953acb --sudo -N {1} --run-list speedymailer-drone -E xomixfuture", drone.Id, Guid.NewGuid().ToString().Replace("-", "")));   //  very long list
                ssh.Disconnect();

                return new
                {
                    Drone = drone,
                    Data = cmd.Result.Replace("\n", "<br>")
                };
            }
        }
Ejemplo n.º 2
0
 public object Deploy(Drone drone)
 {
     return SendCommandToDrone(drone, "chef-client");
 }
Ejemplo n.º 3
0
        private static object SendCommandToDrone(Drone drone, string commandText)
        {
            using (var ssh = new SshClient(drone.Id, "root", "0953acb"))
            {
                ssh.Connect();
                var cmd = ssh.RunCommand(commandText); //  very long list
                ssh.Disconnect();

                if (cmd.ExitStatus > 0)
                    return new
                    {
                        Drone = drone,
                        Data = cmd.Result.Replace("\n", "<br>")
                    };

                return new
                    {
                        Drone = drone,
                        Data = "OK"
                    };
            }
        }
Ejemplo n.º 4
0
 public object Stop(Drone drone)
 {
     return SendCommandToDrone(drone, "/deploy/utils/drone-admin.rb stop");
 }