Skip to content

Commit 42671ec

Browse files
committed
Merge pull request #599 from edsantiago/we_want_information
DockerCmd : always run with verbose
2 parents 2256bc9 + d8190e6 commit 42671ec

File tree

25 files changed

+77
-109
lines changed

25 files changed

+77
-109
lines changed

subtests/docker_cli/attach/attach.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def image_exist(self, image_name):
4545

4646
def pull_image(self, image_name):
4747
dkrcmd = AsyncDockerCmd(self, 'pull', [image_name],
48-
self.config['docker_timeout'],
49-
verbose=True)
48+
self.config['docker_timeout'])
5049
self.loginfo("Executing background command: %s" % dkrcmd)
5150
dkrcmd.execute()
5251
while not dkrcmd.done:
@@ -91,8 +90,7 @@ def initialize(self):
9190
self.sub_stuff['file_desc'].append(run_in_pipe_r)
9291
self.sub_stuff['file_desc'].append(run_in_pipe_w)
9392
self.sub_stuff["run_in_pipe_w"] = run_in_pipe_w
94-
dkrcmd = AsyncDockerCmd(self, 'run', self.sub_stuff['subargs'],
95-
verbose=True)
93+
dkrcmd = AsyncDockerCmd(self, 'run', self.sub_stuff['subargs'])
9694

9795
# Runs in background
9896
self.sub_stuff['cmdresult'] = dkrcmd.execute(run_in_pipe_r)
@@ -121,8 +119,7 @@ def run_once(self):
121119

122120
self.sub_stuff['subargs_a'].append(self.sub_stuff["rand_name"])
123121

124-
dkrcmd = AsyncDockerCmd(self, 'attach', self.sub_stuff['subargs_a'],
125-
verbose=True)
122+
dkrcmd = AsyncDockerCmd(self, 'attach', self.sub_stuff['subargs_a'])
126123
# Runs in background
127124
self.sub_stuff['cmd_attach'] = dkrcmd
128125
self.sub_stuff['cmdresult_attach'] = dkrcmd.execute(attach_in_pipe_r)
@@ -198,8 +195,7 @@ def initialize(self):
198195
self.sub_stuff['file_desc'].append(run_in_pipe_r)
199196
self.sub_stuff['file_desc'].append(run_in_pipe_w)
200197
self.sub_stuff["run_in_pipe_w"] = run_in_pipe_w
201-
dkrcmd = AsyncDockerCmd(self, 'run', self.sub_stuff['subargs'],
202-
verbose=True)
198+
dkrcmd = AsyncDockerCmd(self, 'run', self.sub_stuff['subargs'])
203199

204200
# Runs in background
205201
self.sub_stuff['cmdresult'] = dkrcmd.execute(run_in_pipe_r)
@@ -224,8 +220,7 @@ def run_once(self):
224220

225221
self.sub_stuff['subargs_a'].append(self.sub_stuff["rand_name"])
226222

227-
dkrcmd = AsyncDockerCmd(self, 'attach', self.sub_stuff['subargs_a'],
228-
verbose=True)
223+
dkrcmd = AsyncDockerCmd(self, 'attach', self.sub_stuff['subargs_a'])
229224
# Runs in background
230225
self.sub_stuff['cmd_attach'] = dkrcmd
231226
self.sub_stuff['cmdresult_attach'] = dkrcmd.execute()

subtests/docker_cli/build/build.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ def cleanup(self):
7979
for cid in self.stuff['dc'].list_container_ids():
8080
if cid in self.stuff['existing_containers']:
8181
continue # don't remove previously existing ones
82-
self.logdebug("Remoivng container %s", cid)
83-
dcmd = DockerCmd(self, 'rm', ['--force', '--volumes', cid],
84-
verbose=False)
82+
self.logdebug("Removing container %s", cid)
83+
dcmd = DockerCmd(self, 'rm', ['--force', '--volumes', cid])
8584
dcmd.execute()
8685
dimg = self.stuff['di']
8786
base_repo_fqin = DockerImage.full_name_from_defaults(self.config)
@@ -96,9 +95,8 @@ def cleanup(self):
9695
# never ever remove base_repo_fqin under any circumstance
9796
if thing == base_repo_fqin:
9897
continue
99-
self.logdebug("Remoivng image %s", img)
100-
dcmd = DockerCmd(self, 'rmi', ['--force', thing],
101-
verbose=False)
98+
self.logdebug("Removing image %s", img)
99+
dcmd = DockerCmd(self, 'rmi', ['--force', thing])
102100
dcmd.execute()
103101

104102

@@ -368,7 +366,7 @@ def filedir_contents_postprocess(self, build_def, command, parameter):
368366
else:
369367
cmd = 'ls -la "%s"' % path
370368
subargs = ['--rm', '--attach', 'stdout', build_def.image_name, cmd]
371-
dkrcmd = DockerCmd(self, 'run', subargs, verbose=False)
369+
dkrcmd = DockerCmd(self, 'run', subargs)
372370
dkrcmd.quiet = True
373371
dkrcmd.execute()
374372
exists = dkrcmd.exit_status == 0
@@ -470,7 +468,7 @@ def make_builds(self, source):
470468
os.chdir(dockerfile_dir_path)
471469
subargs = docker_build_options + ["-t", image_name,
472470
dockerfile_dir_path]
473-
dockercmd = DockerCmd(self, 'build', subargs, verbose=True)
471+
dockercmd = DockerCmd(self, 'build', subargs)
474472
# Pass as keywords allows ignoring parameter order
475473
return [self.BuildDef(image_name=image_name,
476474
dockercmd=dockercmd,
@@ -510,9 +508,8 @@ def cleanup(self):
510508
for cid in self.sub_stuff['dc'].list_container_ids():
511509
if cid in self.sub_stuff['existing_containers']:
512510
continue # don't remove previously existing ones
513-
self.logdebug("Remoivng container %s", cid)
514-
dcmd = DockerCmd(self, 'rm', ['--force', '--volumes', cid],
515-
verbose=False)
511+
self.logdebug("Removing container %s", cid)
512+
dcmd = DockerCmd(self, 'rm', ['--force', '--volumes', cid])
516513
dcmd.execute()
517514
dimg = self.sub_stuff['di']
518515
base_repo_fqin = DockerImage.full_name_from_defaults(self.config)
@@ -527,9 +524,8 @@ def cleanup(self):
527524
# never ever remove base_repo_fqin under any circumstance
528525
if thing == base_repo_fqin:
529526
continue
530-
self.logdebug("Remoivng image %s", img)
531-
dcmd = DockerCmd(self, 'rmi', ['--force', thing],
532-
verbose=False)
527+
self.logdebug("Removing image %s", img)
528+
dcmd = DockerCmd(self, 'rmi', ['--force', thing])
533529
dcmd.execute()
534530

535531

subtests/docker_cli/cp/cp.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ def container_files(self, fqin):
149149
"--attach=stdout",
150150
fqin,
151151
"python -c '%s'" % code]
152-
# Data transfered over stdout, don't log it!
153-
nfdc = DockerCmd(self, "run", subargs, verbose=False)
152+
nfdc = DockerCmd(self, "run", subargs)
154153
nfdc.quiet = True
155154
self.logdebug("Executing %s", nfdc.command)
156155
mustpass(nfdc.execute())
@@ -175,8 +174,7 @@ def run_once(self):
175174
% (self.config['max_files'], total))
176175
self.loginfo("Testing copy of %d files from container" % total)
177176
self.sub_stuff['results'] = {} # cont_path -> cmdresult
178-
# Avoid excessive logging
179-
nfdc = DockerCmd(self, 'cp', verbose=False)
177+
nfdc = DockerCmd(self, 'cp')
180178
nfdc.quiet = True
181179
nfiles = 0
182180
for index, srcfile in enumerate(self.sub_stuff['lastfiles']):

subtests/docker_cli/create/create_remote_tag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def init_save_images(self):
4444
self.loginfo("Removing images...")
4545
subargs = ['--force']
4646
subargs += [img.full_name for img in existing_images]
47-
mustpass(DockerCmd(self, 'rmi', subargs, verbose=True).execute())
47+
mustpass(DockerCmd(self, 'rmi', subargs).execute())
4848
# Wait for images to actually go away
4949
_fn = lambda: self.long_id_in_images(long_id)
5050
gone = utils.wait_for(_fn, 60, step=1,

subtests/docker_cli/images_all/images_all.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _init_container(self, prefix, fin, subargs, cmd):
4545
self.sub_stuff['containers'].append(name)
4646
subargs.append(fin)
4747
subargs.append(cmd)
48-
mustpass(DockerCmd(self, 'run', subargs, verbose=False).execute())
48+
mustpass(DockerCmd(self, 'run', subargs).execute())
4949
return name
5050

5151
def _create_image(self, parent, prefix, cmd):
@@ -57,11 +57,10 @@ def _create_image(self, parent, prefix, cmd):
5757
images = self.sub_stuff['di']
5858
cont_name = self._init_container("test", parent, [], cmd)
5959
img_name = images.get_unique_name(prefix)
60-
dkrcmd = DockerCmd(self, "commit", [cont_name, img_name],
61-
verbose=False)
60+
dkrcmd = DockerCmd(self, "commit", [cont_name, img_name])
6261
img_id = mustpass(dkrcmd.execute()).stdout.strip()
63-
mustpass(DockerCmd(self, 'rm', ['--force', '--volumes', cont_name],
64-
verbose=False).execute())
62+
mustpass(DockerCmd(self, 'rm',
63+
['--force', '--volumes', cont_name]).execute())
6564
self.sub_stuff['images'].append(img_id)
6665
return [img_id, img_name]
6766

@@ -135,8 +134,8 @@ def id_in(long_id, images):
135134
% (image[1], err_str()))
136135
if image[3] and image[4] is not None:
137136
history = mustpass(DockerCmd(self, 'history',
138-
['--no-trunc', '-q', image[0]],
139-
verbose=False).execute()).stdout
137+
['--no-trunc', '-q',
138+
image[0]]).execute()).stdout
140139
for parent in image[4]:
141140
self.failif(parent not in history, "Parent image '%s' of "
142141
"image '%s' was not found in `docker history`:"
@@ -185,23 +184,23 @@ def run_once(self):
185184
# Verify
186185
self.verify_images((test_a, test_a1, test_b, test_b1))
187186
# Untag test_a
188-
mustpass(DockerCmd(self, 'rmi', [test_a[1]], verbose=False).execute())
187+
mustpass(DockerCmd(self, 'rmi', [test_a[1]]).execute())
189188
test_a[3] = False # exists, untagged
190189
# Verify
191190
self.verify_images((test_a, test_a1, test_b, test_b1))
192191
# Untag test_a.1
193-
mustpass(DockerCmd(self, 'rmi', [test_a1[1]], verbose=False).execute())
192+
mustpass(DockerCmd(self, 'rmi', [test_a1[1]]).execute())
194193
test_a1[2:4] = [False, False] # doesn't exist, not tagged
195194
test_a[2:4] = [False, False] # doesn't exist, not tagged
196195
# Verify
197196
self.verify_images((test_a, test_a1, test_b, test_b1))
198197
# Untag test_b.1
199-
mustpass(DockerCmd(self, 'rmi', [test_b1[1]], verbose=False).execute())
198+
mustpass(DockerCmd(self, 'rmi', [test_b1[1]]).execute())
200199
test_b1[2:4] = [False, False] # doesn't exist, not tagged
201200
# Verify
202201
self.verify_images((test_a, test_a1, test_b, test_b1))
203202
# Remove the last image by id
204-
mustpass(DockerCmd(self, 'rmi', [test_b[0]], verbose=False).execute())
203+
mustpass(DockerCmd(self, 'rmi', [test_b[0]]).execute())
205204
test_b[2:4] = [False, False] # doesn't exist, not tagged
206205
self.verify_images((test_a, test_a1, test_b, test_b1))
207206

subtests/docker_cli/iptable/iptable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def initialize(self):
107107
def run_once(self):
108108
super(iptable_base, self).run_once()
109109
subargs = self.sub_stuff['subargs']
110-
mustpass(DockerCmd(self, 'run -d', subargs, verbose=True).execute())
110+
mustpass(DockerCmd(self, 'run -d', subargs).execute())
111111
self.sub_stuff['rules_during'] = self.read_iptable_rules(None)
112112

113113
def postprocess(self):

subtests/docker_cli/kill/kill_utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _init_container_normal(self, name):
8080
subargs.append("bash")
8181
subargs.append("-c")
8282
subargs.append(self.config['exec_cmd'])
83-
container = AsyncDockerCmd(self, 'run', subargs, verbose=False)
83+
container = AsyncDockerCmd(self, 'run', subargs)
8484
self.sub_stuff['container_cmd'] = container
8585
container.execute()
8686

@@ -103,7 +103,7 @@ def _init_container_attached(self, name):
103103
subargs.append("bash")
104104
subargs.append("-c")
105105
subargs.append(self.config['exec_cmd'])
106-
container = DockerCmd(self, 'run', subargs, verbose=False)
106+
container = DockerCmd(self, 'run', subargs)
107107
self.sub_stuff['container_cmd'] = container
108108
mustpass(container.execute())
109109

@@ -113,7 +113,7 @@ def _init_container_attached(self, name):
113113
else:
114114
subargs = []
115115
subargs.append(name)
116-
container = AsyncDockerCmd(self, 'attach', subargs, verbose=False)
116+
container = AsyncDockerCmd(self, 'attach', subargs)
117117
self.sub_stuff['container_cmd'] = container # overwrites finished cmd
118118
container.execute()
119119

@@ -199,17 +199,15 @@ def _populate_kill_cmds(self, extra_subargs):
199199
sig_long = False
200200
else:
201201
subargs = ["-s %s" % signal] + extra_subargs
202-
kill_cmds.append(DockerCmd(self, 'kill', subargs,
203-
verbose=False))
202+
kill_cmds.append(DockerCmd(self, 'kill', subargs))
204203

205204
# Kill -9 is the last one :-)
206205
signal = 9
207206
signals_sequence.append(signal)
208207
if self.config.get('kill_map_signals'):
209208
signal = SIGNAL_MAP.get(signal, signal)
210209
kill_cmds.append(DockerCmd(self, 'kill',
211-
["-s %s" % signal] + extra_subargs,
212-
verbose=False))
210+
["-s %s" % signal] + extra_subargs))
213211

214212
if sigproxy:
215213
self.logdebug("kill_command_example: Killing directly the "

subtests/docker_cli/kill_bad/kill_bad.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def _init_container(self, name):
4242
subargs.append("bash")
4343
subargs.append("-c")
4444
subargs.append(self.config['exec_cmd'])
45-
container = AsyncDockerCmd(self, 'run', subargs, verbose=False)
45+
container = AsyncDockerCmd(self, 'run', subargs)
4646
self.sub_stuff['container_cmd'] = container
4747
container.execute()
4848

@@ -70,15 +70,14 @@ def run_once(self):
7070
for signal in self.config['bad_signals'].split(','):
7171
mustfail(DockerCmd(self, 'kill',
7272
['-s', signal,
73-
self.sub_stuff['container_name']],
74-
verbose=False).execute(), 1)
73+
self.sub_stuff['container_name']]).execute(),
74+
1)
7575
self.failif(self.sub_stuff['container_cmd'].done, "Testing "
7676
"container died after using signal %s." % signal)
7777
dkrcnt = DockerContainers(self)
7878
nonexisting_name = dkrcnt.get_unique_name()
7979
self.logdebug("Killing nonexisting containe.")
80-
mustfail(DockerCmd(self, 'kill', [nonexisting_name],
81-
verbose=False).execute(), 1)
80+
mustfail(DockerCmd(self, 'kill', [nonexisting_name]).execute(), 1)
8281

8382
def postprocess(self):
8483
"""

subtests/docker_cli/kill_stopped/kill_utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _init_container_normal(self, name):
8080
subargs.append("bash")
8181
subargs.append("-c")
8282
subargs.append(self.config['exec_cmd'])
83-
container = AsyncDockerCmd(self, 'run', subargs, verbose=False)
83+
container = AsyncDockerCmd(self, 'run', subargs)
8484
self.sub_stuff['container_cmd'] = container
8585
container.execute()
8686

@@ -103,7 +103,7 @@ def _init_container_attached(self, name):
103103
subargs.append("bash")
104104
subargs.append("-c")
105105
subargs.append(self.config['exec_cmd'])
106-
container = DockerCmd(self, 'run', subargs, verbose=False)
106+
container = DockerCmd(self, 'run', subargs)
107107
self.sub_stuff['container_cmd'] = container
108108
mustpass(container.execute())
109109

@@ -113,7 +113,7 @@ def _init_container_attached(self, name):
113113
else:
114114
subargs = []
115115
subargs.append(name)
116-
container = AsyncDockerCmd(self, 'attach', subargs, verbose=False)
116+
container = AsyncDockerCmd(self, 'attach', subargs)
117117
self.sub_stuff['container_cmd'] = container # overwrites finished cmd
118118
container.execute()
119119

@@ -199,17 +199,15 @@ def _populate_kill_cmds(self, extra_subargs):
199199
sig_long = False
200200
else:
201201
subargs = ["-s %s" % signal] + extra_subargs
202-
kill_cmds.append(DockerCmd(self, 'kill', subargs,
203-
verbose=False))
202+
kill_cmds.append(DockerCmd(self, 'kill', subargs))
204203

205204
# Kill -9 is the last one :-)
206205
signal = 9
207206
signals_sequence.append(signal)
208207
if self.config.get('kill_map_signals'):
209208
signal = SIGNAL_MAP.get(signal, signal)
210209
kill_cmds.append(DockerCmd(self, 'kill',
211-
["-s %s" % signal] + extra_subargs,
212-
verbose=False))
210+
["-s %s" % signal] + extra_subargs))
213211

214212
if sigproxy:
215213
self.logdebug("kill_command_example: Killing directly the "

subtests/docker_cli/kill_stress/kill_stress.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def _populate_kill_cmds(self, extra_subargs):
9595
if sigproxy:
9696
self.sub_stuff['kill_cmds'].append(False)
9797
else:
98-
dcmd = DockerCmd(self, 'kill', extra_subargs, verbose=False)
98+
dcmd = DockerCmd(self, 'kill', extra_subargs)
9999
self.sub_stuff['kill_cmds'].append(dcmd)
100100
self.sub_stuff['signals_set'] = signals_set
101101

0 commit comments

Comments
 (0)