Add valid_url function

This commit is contained in:
Thomas S Hatch 2013-04-05 16:07:27 -06:00
parent d13493cc6a
commit 2c0f79df57

View File

@ -22,6 +22,7 @@ import tempfile
import subprocess
import zmq
from calendar import month_abbr as months
import salt._compat
try:
import fcntl
@ -932,3 +933,11 @@ def option(
if value in pillar:
return pillar[value]
return default
def valid_url(url, protos):
'''
Return true if the passed url is in the list of accepted protos
'''
if salt._compat.urlparse.urlparse(url).scheme in protos:
return True