Skip to content

Commit 66f2345

Browse files
author
Kevin McDonald
committed
Filter env vars that start with underscore
1 parent c0ec9f7 commit 66f2345

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

SoftLayer/CLI/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,19 @@ def cli(env,
146146
)
147147
env.client = client
148148

149-
env.vars['timings'] = SoftLayer.TimingTransport(env.client.transport)
150-
env.client.transport = env.vars['timings']
149+
env.vars['_timings'] = SoftLayer.TimingTransport(env.client.transport)
150+
env.client.transport = env.vars['_timings']
151151

152152

153153
@cli.resultcallback()
154154
@environment.pass_env
155155
def output_result(env, timings=False, *args, **kwargs):
156156
"""Outputs the results returned by the CLI and also outputs timings."""
157157

158-
if timings and env.vars.get('timings'):
158+
if timings and env.vars.get('_timings'):
159159
timing_table = formatting.Table(['service', 'method', 'time'])
160160

161-
calls = env.vars['timings'].get_last_calls()
161+
calls = env.vars['_timings'].get_last_calls()
162162
for call, _, duration in calls:
163163
timing_table.add_row([call.service, call.method, duration])
164164

SoftLayer/shell/cmd_env.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
@environment.pass_env
1212
def cli(env):
1313
"""Print environment variables."""
14-
env.fout(formatting.iter_to_table(env.vars))
14+
filtered_vars = dict([(k, v)
15+
for k, v in env.vars.items()
16+
if not k.startswith('_')])
17+
env.fout(formatting.iter_to_table(filtered_vars))

0 commit comments

Comments
 (0)