From d21546becab576d890d60968d203342012d356ac Mon Sep 17 00:00:00 2001
From: Kiall Mac Innes <kiall@managedit.ie>
Date: Tue, 11 Dec 2012 16:41:50 -0800
Subject: [PATCH] Provide a sane error message when --os-auth-url or
 --os-endpoint have not been supplied.

Change-Id: I930ea853cec00db87c87115ab3e3a94b7fe3c703
---
 monikerclient/cli/base.py    | 4 ++++
 monikerclient/v1/__init__.py | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/monikerclient/cli/base.py b/monikerclient/cli/base.py
index 8ab1a457..e4c88072 100644
--- a/monikerclient/cli/base.py
+++ b/monikerclient/cli/base.py
@@ -36,6 +36,10 @@ class Command(CliffCommand):
             'region_name': self.app.options.os_region_name,
         }
 
+        if client_args['endpoint'] is None and client_args['auth_url'] is None:
+            raise ValueError('Either the --os-endpoint or --os-auth-url '
+                             'argument must be supplied')
+
         self.client = Client(**client_args)
 
         return super(Command, self).run(parsed_args)
diff --git a/monikerclient/v1/__init__.py b/monikerclient/v1/__init__.py
index 7eba9b67..4c52804c 100644
--- a/monikerclient/v1/__init__.py
+++ b/monikerclient/v1/__init__.py
@@ -46,7 +46,7 @@ class Client(object):
         elif endpoint:
             auth = None
         else:
-            raise ValueError('Either an auth_url or endpoint must be supplied')
+            raise ValueError('Either an endpoint or auth_url must be supplied')
 
         headers = {'Content-Type': 'application/json'}