mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Add valid_url function
This commit is contained in:
parent
d13493cc6a
commit
2c0f79df57
@ -22,6 +22,7 @@ import tempfile
|
|||||||
import subprocess
|
import subprocess
|
||||||
import zmq
|
import zmq
|
||||||
from calendar import month_abbr as months
|
from calendar import month_abbr as months
|
||||||
|
import salt._compat
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import fcntl
|
import fcntl
|
||||||
@ -932,3 +933,11 @@ def option(
|
|||||||
if value in pillar:
|
if value in pillar:
|
||||||
return pillar[value]
|
return pillar[value]
|
||||||
return default
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user