diff options
| author | Steve Martinelli <stevemar@ca.ibm.com> | 2014-04-01 10:30:03 -0500 |
|---|---|---|
| committer | Steve Martinelli <stevemar@ca.ibm.com> | 2014-04-14 22:16:59 -0500 |
| commit | 01db6d977f518d6a348a89549ca566c4aa780e79 (patch) | |
| tree | fa6c240a53834158969d576a65da9d12825889e2 /openstackclient/identity | |
| parent | ee22070473dab8bfa3e89d47f1f5a77918c2b026 (diff) | |
| download | python-openstackclient-01db6d977f518d6a348a89549ca566c4aa780e79.tar.gz | |
move read_blob_file_contents to utils
Thinking ahead, a few other upcoming keystone features could
benefit from reading contents from a file. Thus, moving the
function from policy to utils.
Change-Id: I713ab0e5a00c949ad996daf83b775a7c19044888
Diffstat (limited to 'openstackclient/identity')
| -rw-r--r-- | openstackclient/identity/v3/policy.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/openstackclient/identity/v3/policy.py b/openstackclient/identity/v3/policy.py index a760d8cd..641ff9c8 100644 --- a/openstackclient/identity/v3/policy.py +++ b/openstackclient/identity/v3/policy.py @@ -48,7 +48,7 @@ class CreatePolicy(show.ShowOne): def take_action(self, parsed_args): self.log.debug('take_action(%s)' % parsed_args) - blob = _read_blob_file_contents(parsed_args.blob_file) + blob = utils.read_blob_file_contents(parsed_args.blob_file) identity_client = self.app.client_manager.identity policy = identity_client.policies.create( @@ -138,7 +138,7 @@ class SetPolicy(command.Command): blob = None if parsed_args.blob_file: - blob = _read_blob_file_contents(parsed_args.blob_file) + blob = utils.read_blob_file_contents(parsed_args.blob_file) kwargs = {} if blob: @@ -174,9 +174,3 @@ class ShowPolicy(show.ShowOne): parsed_args.policy) return zip(*sorted(six.iteritems(policy._info))) - - -def _read_blob_file_contents(blob_file): - with open(blob_file) as file: - blob = file.read().strip() - return blob |
