Skip to content

Commit

Permalink
Replace use of deprecated pipes with shlex for quoting. #1370
Browse files Browse the repository at this point in the history
  • Loading branch information
mfeit-internet2 committed Jan 9, 2024
1 parent 3361aba commit e91dc77
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pscheduler-core/pscheduler-core/result
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import datetime
import optparse
import os
import pipes
import pscheduler
import shlex
import sys


Expand Down Expand Up @@ -239,7 +239,7 @@ def dump_run(run_json, exit_on_error=False, print_run_url=False):

print()
print(pscheduler.prefixed_wrap(
"", " ".join([ pipes.quote(arg) for arg in task_cli ]),
"", " ".join([ shlex.quote(arg) for arg in task_cli ]),
indent=2))
print()

Expand Down
4 changes: 2 additions & 2 deletions pscheduler-core/pscheduler-core/schedule
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import datetime
import optparse
import os
import pipes
import pscheduler
import pytz
import shlex
import sys
import urllib

Expand Down Expand Up @@ -291,7 +291,7 @@ for run in schedule:


task_cli = [ test ]
task_cli.extend([ pipes.quote(arg) for arg in run["cli"] ])
task_cli.extend([ shlex.quote(arg) for arg in run["cli"] ])

if not first:
print()
Expand Down
4 changes: 2 additions & 2 deletions pscheduler-core/pscheduler-core/task
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import datetime
import optparse
import os
import pipes
import shlex
import pscheduler
import subprocess
import sys
Expand Down Expand Up @@ -802,6 +802,6 @@ if options.output is not None:
# TODO: Pass --verbose once watch supports that.
watch_args.append(task_url)

watch_args = " ".join([ pipes.quote(arg) for arg in watch_args ])
watch_args = " ".join([ shlex.quote(arg) for arg in watch_args ])
log.debug("Handing off: %s", watch_args)
os.execl("/bin/sh", "/bin/sh", "-c", watch_args)
5 changes: 2 additions & 3 deletions pscheduler-core/pscheduler-core/troubleshoot
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ are working.

import optparse
import os
import pipes
import re
import shlex
import socket
import sys
import time
Expand All @@ -30,7 +30,6 @@ pscheduler.set_graceful_exit()
#

class VerbatimParser(optparse.OptionParser):
def format_epilog(self, formatter):
return self.epilog

opt_parser = VerbatimParser(
Expand Down Expand Up @@ -155,7 +154,7 @@ def failed_diags(run, why="Task failed to run properly."):
print()
result_args = ["pscheduler", "result", "--diags", "--archivings", run]
os.execl("/bin/sh", "/bin/sh", "-c",
" ".join([pipes.quote(arg) for arg in result_args]))
" ".join([shlex.quote(arg) for arg in result_args]))



Expand Down

0 comments on commit e91dc77

Please sign in to comment.