From a3c1063a3773c1251e9c792bfddc53be169d6957 Mon Sep 17 00:00:00 2001 From: Trevor H Date: Wed, 27 May 2015 01:51:02 -0400 Subject: [PATCH] fix deprecated pymongo usage causing errors in latest pymongo --- salt/tops/mongo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/tops/mongo.py b/salt/tops/mongo.py index 83058e3443..fdaef38740 100644 --- a/salt/tops/mongo.py +++ b/salt/tops/mongo.py @@ -103,7 +103,7 @@ def top(**kwargs): environment_field = __opts__['master_tops']['mongo'].get('environment_field', 'environment') log.info('connecting to {0}:{1} for mongo ext_tops'.format(host, port)) - conn = pymongo.Connection(host, port) + conn = pymongo.MongoClient(host, port) log.debug('using database \'{0}\''.format(__opts__['mongo.db'])) mdb = conn[__opts__['mongo.db']] @@ -127,7 +127,7 @@ def top(**kwargs): ) ) - result = mdb[collection].find_one({id_field: minion_id}, fields=[states_field, environment_field]) + result = mdb[collection].find_one({id_field: minion_id}, projection=[states_field, environment_field]) if result and states_field in result: if environment_field in result: environment = result[environment_field]