Permalink
Browse files

adding --reimage option

  • Loading branch information...
1 parent ba4e0b7 commit 2f382f1a68610f526686ad3619257bd6a700b429 @smarx committed Sep 14, 2012
Showing with 21 additions and 15 deletions.
  1. +15 −12 README.md
  2. +6 −3 WazMonkey/Program.cs
View
@@ -5,21 +5,24 @@ WazMonkey chooses a role instance from your service at random and reboots it.
## Usage:
- WazMonkey v0.1
- Copyright (C) 2012 Steve Marx
- Usage: WazMonkey -p foo.publishSettings -n myservice -s production
+ WazMonkey v0.2
+ Copyright (C) 2012 Steve Marx
+ Usage: WazMonkey -p foo.publishSettings -n myservice -s production
- -p, --publishSettings .publishSettings file - specify either this or a
- .pfx file
+ -p, --publishSettings .publishSettings file - specify either this or a
+ .pfx file
- --pfx .pfx certificate file - specify either this or a
- .publishSettings file
+ --pfx .pfx certificate file - specify either this or a
+ .publishSettings file
- --subscriptionId subscriptionId to use, defaults to first
- subscription found in the .publishSettings file
+ --subscriptionId subscriptionId to use, defaults to first
+ subscription found in the .publishSettings file
- -n, --serviceName Required. Name of the cloud service
+ -n, --serviceName Required. Name of the cloud service
- -s, --slot Required. The slot ("production" or "staging")
+ -s, --slot Required. The slot ("production" or "staging")
- --help Display this help screen.
+ --reimage Reimage the instance (instead of reboot, the
+ default)
+
+ --help Display this help screen.
View
@@ -28,12 +28,15 @@ class Options : CommandLineOptionsBase
[Option("s", "slot", Required = true, HelpText = @"The slot (""production"" or ""staging"")")]
public string Slot { get; set; }
+ [Option(null, "reimage", Required = false, HelpText = "Reimage the instance (instead of reboot, the default)")]
+ public bool Reimage { get; set; }
+
[HelpOption(HelpText = "Display this help screen.")]
public string GetUsage()
{
var help = new HelpText
{
- Heading = new HeadingInfo("WazMonkey", "v0.1"),
+ Heading = new HeadingInfo("WazMonkey", "v0.2"),
Copyright = new CopyrightInfo("Steve Marx", 2012),
AdditionalNewLineAfterOption = true,
AddDashesToOption = true
@@ -130,10 +133,10 @@ static void Main(string[] args)
// choose one at random
var instance = instances[new Random().Next(instances.Length)];
- Console.WriteLine("Rebooting {0}.", instance);
+ Console.WriteLine("{0} {1}.", options.Reimage ? "Reimaging" : "Rebooting", instance);
// reboot it
- req = (HttpWebRequest)WebRequest.Create(string.Format("{0}/roleinstances/{1}?comp=reboot", baseAddress, instance));
+ req = (HttpWebRequest)WebRequest.Create(string.Format("{0}/roleinstances/{1}?comp={2}", baseAddress, instance, options.Reimage ? "reimage" : "reboot"));
req.Method = "POST";
req.ContentLength = 0;
req.Headers["x-ms-version"] = "2012-03-01";

0 comments on commit 2f382f1

Please sign in to comment.