From 20f96561cd69884602431d44fbafa9bcf06ee41d Mon Sep 17 00:00:00 2001
From: Marco Mariani <marco.mariani@nexedi.com>
Date: Tue, 7 May 2013 10:43:23 +0200
Subject: [PATCH] support for --state argument in request

---
 slapos/cli/request.py | 5 ++++-
 slapos/client.py      | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/slapos/cli/request.py b/slapos/cli/request.py
index 1fb7d9c15..b5a687a54 100644
--- a/slapos/cli/request.py
+++ b/slapos/cli/request.py
@@ -39,7 +39,10 @@ class RequestCommand(ClientConfigCommand):
                         help="Node request option 'option1=value1 option2=value2'")
 
         ap.add_argument('--type',
-                        help='Define software type to be requested')
+                        help='Software type to be requested')
+
+        ap.add_argument('--state',
+                        help='State of the requested instance')
 
         ap.add_argument('--slave',
                         action='store_true',
diff --git a/slapos/client.py b/slapos/client.py
index dcc6b2a3b..d6ac6c874 100644
--- a/slapos/client.py
+++ b/slapos/client.py
@@ -37,6 +37,8 @@ from slapos.slap import ResourceNotReady
 
 
 class ClientConfig(object):
+  state = None
+
   def __init__(self, args, configp=None):
     # XXX configp cannot possibly be optional
     """
@@ -115,7 +117,6 @@ def init(conf):
 
 
 def do_request(conf, local):
-  # Request instance
   print("Requesting %s..." % conf.reference)
   if conf.software_url in local:
     conf.software_url = local[conf.software_url]
@@ -126,6 +127,7 @@ def do_request(conf, local):
       partition_parameter_kw = conf.parameters,
       software_type = conf.type,
       filter_kw = conf.node,
+      state = conf.state,
       shared = conf.slave
     )
     print "Instance requested.\nState is : %s." % partition.getState()
-- 
2.30.9