diff options
| author | Yong Sheng Gong <gongysh@cn.ibm.com> | 2012-06-24 16:11:11 +0800 |
|---|---|---|
| committer | Yong Sheng Gong <gongysh@cn.ibm.com> | 2012-06-25 18:19:18 +0800 |
| commit | 50c46f61d1a76b5429c20ad61203afedc7c508bb (patch) | |
| tree | 96ea2c8215533a36441a2005e4f1c15b822382a6 /quantumclient/common | |
| parent | dd803f8e26f4c3a3b8f1b9e7526d0e1980b2491c (diff) | |
| download | python-neutronclient-0.1.0.tar.gz | |
add --fixed-ip argument to create port0.1.0
add --fixed-ip argument to create port and add list and dict type for unknow option
now we can use known option feature:
quantumv2 create_port --fixed-ip subnet_id=<id>,ip_address=<ip>
--fixed-ip subnet_id=<id>, ip_address=<ip2> network_id
or unknown option feature:
one ip:
quantumv2 create_port network_id --fixed_ips type=dict list=true subnet_id=<id>,ip_address=<ip>
two ips:
quantumv2 create_port network_id --fixed_ips type=dict subnet_id=<id>,ip_address=<ip> subnet_id=<id>,ip_address=<ip2>
to create port
Please download: https://review.openstack.org/#/c/8794/4 and
set core_plugin = quantum.db.db_base_plugin_v2.QuantumDbPluginV2 on quantum server side
Patch 2: support cliff 1.0
Patch 3: support specify auth strategy, for now, any other auth strategy than keystone will disable auth,
format port output
Patch 4: format None as '' when outputing, deal with list of dict, add QUANTUMCLIENT_DEBUG env to enable http req/resp print,
which is helpful for testing nova integration
Patch 5: fix interactive mode, and initialize_app problem
Change-Id: I693848c75055d1947862d55f4b538c1dfb1e86db
Diffstat (limited to 'quantumclient/common')
| -rw-r--r-- | quantumclient/common/clientmanager.py | 2 | ||||
| -rw-r--r-- | quantumclient/common/command.py | 6 | ||||
| -rw-r--r-- | quantumclient/common/utils.py | 17 |
3 files changed, 22 insertions, 3 deletions
diff --git a/quantumclient/common/clientmanager.py b/quantumclient/common/clientmanager.py index ee2fcf3..1c1f1ac 100644 --- a/quantumclient/common/clientmanager.py +++ b/quantumclient/common/clientmanager.py @@ -53,6 +53,7 @@ class ClientManager(object): username=None, password=None, region_name=None, api_version=None, + auth_strategy=None ): self._token = token self._url = url @@ -64,6 +65,7 @@ class ClientManager(object): self._region_name = region_name self._api_version = api_version self._service_catalog = None + self._auth_strategy = auth_strategy return def initialize(self): diff --git a/quantumclient/common/command.py b/quantumclient/common/command.py index 405f655..f2706d0 100644 --- a/quantumclient/common/command.py +++ b/quantumclient/common/command.py @@ -33,3 +33,9 @@ class OpenStackCommand(Command): return else: return super(OpenStackCommand, self).run(parsed_args) + + def get_data(self, parsed_args): + pass + + def take_action(self, parsed_args): + return self.get_data(parsed_args) diff --git a/quantumclient/common/utils.py b/quantumclient/common/utils.py index 4044ae8..bed02e0 100644 --- a/quantumclient/common/utils.py +++ b/quantumclient/common/utils.py @@ -62,9 +62,9 @@ def to_primitive(value): return value -def dumps(value): +def dumps(value, indent=None): try: - return json.dumps(value) + return json.dumps(value, indent=indent) except TypeError: pass return json.dumps(to_primitive(value)) @@ -126,17 +126,28 @@ def get_item_properties(item, fields, mixed_case_fields=[], formatters={}): data = item[field_name] else: data = getattr(item, field_name, '') + if data is None: + data = '' row.append(data) return tuple(row) -def __str2bool(strbool): +def str2bool(strbool): if strbool is None: return None else: return strbool.lower() == 'true' +def str2dict(strdict): + '''@param strdict: key1=value1,key2=value2''' + _info = {} + for kv_str in strdict.split(","): + k, v = kv_str.split("=", 1) + _info.update({k: v}) + return _info + + def http_log(_logger, args, kwargs, resp, body): if not _logger.isEnabledFor(logging.DEBUG): return |
