File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed
Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -896,7 +896,7 @@ def get_jmx_status():
896896 check_data = defaultdict (lambda : defaultdict (list ))
897897 try :
898898 if os .path .exists (java_status_path ):
899- java_jmx_stats = yaml .load (file (java_status_path ))
899+ java_jmx_stats = yaml .safe_load (file (java_status_path ))
900900
901901 status_age = time .time () - java_jmx_stats .get ('timestamp' )/ 1000 # JMX timestamp is saved in milliseconds
902902 jmx_checks = java_jmx_stats .get ('checks' , {})
@@ -941,7 +941,7 @@ def get_jmx_status():
941941 check_statuses .append (check_status )
942942
943943 if os .path .exists (python_status_path ):
944- python_jmx_stats = yaml .load (file (python_status_path ))
944+ python_jmx_stats = yaml .safe_load (file (python_status_path ))
945945 jmx_checks = python_jmx_stats .get ('invalid_checks' , {})
946946 for check_name , excep in jmx_checks .iteritems ():
947947 check_statuses .append (CheckStatus (check_name , [], init_failed_error = excep ))
Original file line number Diff line number Diff line change 1111# 3p
1212import yaml # noqa, let's guess, probably imported somewhere
1313try :
14- from yaml import CLoader as yLoader
15- from yaml import CDumper as yDumper
14+ from yaml import CSafeLoader as yLoader
15+ from yaml import CSafeDumper as yDumper
1616except ImportError :
1717 # On source install C Extensions might have not been built
18- from yaml import Loader as yLoader # noqa, imported from here elsewhere
19- from yaml import Dumper as yDumper # noqa, imported from here elsewhere
18+ from yaml import SafeLoader as yLoader # noqa, imported from here elsewhere
19+ from yaml import SafeDumper as yDumper # noqa, imported from here elsewhere
2020
2121# These classes are now in utils/, they are just here for compatibility reasons,
2222# if a user actually uses them in a custom check
Original file line number Diff line number Diff line change @@ -146,6 +146,6 @@ def get_jmx_appnames(cls):
146146 check_names = []
147147 jmx_status_path = os .path .join (cls ._get_dir (), cls ._STATUS_FILE )
148148 if os .path .exists (jmx_status_path ):
149- jmx_checks = yaml .load (file (jmx_status_path )).get ('checks' , {})
149+ jmx_checks = yaml .safe_load (file (jmx_status_path )).get ('checks' , {})
150150 check_names = [name for name in jmx_checks .get ('initialized_checks' , {}).iterkeys ()]
151151 return check_names
You can’t perform that action at this time.
0 commit comments