Skip to content

Commit

Permalink
Support Python 3 (#2837)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmuesch authored Jan 17, 2019
1 parent 4d13186 commit be03437
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
- stage: test
env: CHECK=cassandra_nodetool PYTHON3=true
- stage: test
env: CHECK=ceph
env: CHECK=ceph PYTHON3=true
- stage: test
env: CHECK=cisco_aci
- stage: test
Expand Down
2 changes: 1 addition & 1 deletion ceph/datadog_checks/ceph/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ceph import Ceph
from .ceph import Ceph

__all__ = [
'__version__',
Expand Down
12 changes: 3 additions & 9 deletions ceph/datadog_checks/ceph/ceph.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

"""ceph check
Collects metrics from ceph clusters
"""

# stdlib
from __future__ import division
import os
import re

# project
from datadog_checks.checks import AgentCheck
from datadog_checks.utils.subprocess_output import get_subprocess_output
from datadog_checks.config import _is_affirmative

# third party
import simplejson as json
from six import iteritems


class Ceph(AgentCheck):
Expand Down Expand Up @@ -127,7 +121,7 @@ def _extract_metrics(self, raw, tags):
# so we won't send the metric osd.pct_used
if 'checks' in raw['health_detail']:
checks = raw['health_detail']['checks']
for check_name, check_detail in checks.iteritems():
for check_name, check_detail in iteritems(checks):
if check_name == 'OSD_NEARFULL':
health['num_near_full_osds'] = len(check_detail['detail'])
if check_name == 'OSD_FULL':
Expand Down
8 changes: 0 additions & 8 deletions ceph/tests/test_ceph.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import os
import copy
import mock
import pytest
import simplejson as json

# Constants
Expand All @@ -33,13 +32,6 @@
EXPECTED_SERVICE_TAGS = ['optional:tag1']


@pytest.fixture
def aggregator():
from datadog_checks.stubs import aggregator
aggregator.reset()
return aggregator


def mock_data(file):
filepath = os.path.join(FIXTURE_DIR, file)
with open(filepath, "r") as f:
Expand Down
4 changes: 1 addition & 3 deletions ceph/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
minversion = 2.0
basepython = py27
envlist =
ceph
{py27,py36}-latest
flake8

[testenv]
usedevelop = true
platform = linux|darwin|win32

[testenv:ceph]
deps =
-e../datadog_checks_base[deps]
-rrequirements-dev.txt
Expand Down

0 comments on commit be03437

Please sign in to comment.