<commit_before>#!/usr/bin/env python

import rados
import rpm
# import subprocess
# import logging
# import argparse

conf = "/etc/ceph/ceph.conf"
ad_key = "/etc/ceph/ceph.client.admin.keyring"


class CephCheck(object):

    def __init__(self, conf=conf, ad_key=ad_key):
        self.conf = conf
        self.ad_key = ad_key

    def verify(self):
        # 1. Check for ceph-deploy rpm
        ts = rpm.TransactionSet()
        mi = ts.dbMatch()
        mi.pattern('name', rpm.RPMMIRE_GLOB, 'ceph-deploy')
        try:
            for h in mi:
                print("Checking ceph package installations.\n")
                print("%s-%s-%s" % (h['name'], h['version'], h['release']))
        except:
            print("Not able to find `ceph-deploy`")
        # 2. Check for ceph.conf
        if not self.conf:
            print("/etc/ceph/ceph.conf not found")
            print("Is this node part of the cluster?")


        self.verify_conf()

    def verify_conf(self):
        # if self.conf:
        print("\nVerifying configurations!")
        conf_file = open(self.conf)
        pass

    def connect(self):
        """Initialize the cluster connection"""
        try:
            cluster = rados.Rados(conffile='')
        except TypeError as e:
            raise e
<commit_msg>Added the first two checks<commit_after>#!/usr/bin/env python

import rados
import rpm
# import subprocess
# import logging
# import argparse

# Refer
# http://permalink.gmane.org/gmane.comp.file-systems.ceph.user/23090
# https://github.com/ceph/calamari/blob/master/salt/srv/salt/_modules/ceph.py

conf = "/etc/ceph/ceph.conf"
ad_key = "/etc/ceph/ceph.client.admin.keyring"


class CephCheck(object):

    def __init__(self, conf=conf, ad_key=ad_key):
        self.conf = conf
        self.ad_key = ad_key

    def verify(self):
        # 1. Check for ceph-deploy rpm
        print("\nceph-check :\n")
        print("Check #1 :")
        ts = rpm.TransactionSet()
        mi = ts.dbMatch()
        mi.pattern('name', rpm.RPMMIRE_GLOB, 'ceph*')
        print("Checking ceph package installations.\n")
        try:
            for h in mi:
                print("%s-%s-%s" % (h['name'], h['version'], h['release']))
        except:
            print("Not able to find `ceph packages`")
        # 2. Check for ceph.conf
        print("\nCheck #2 :")
        try:
            conf_file = open(self.conf)
            print(type(conf_file))
        except:
            print(self.conf, "doesn't exist!")
        #if not self.conf:
        #    print("/etc/ceph/ceph.conf not found")
        #    print("Is this node part of the cluster?")

    def connect(self):
        """Initialize the cluster connection"""
        try:
            cluster = rados.Rados(conffile='')
        except TypeError as e:
            raise e

{'fraction_non_alphanumeric': 0.13435495367070563, 'fraction_numerical': 0.003920171062009979, 'mean_word_length': 2.047774158523344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6107429', 'n_tokens_mistral': 931, 'n_tokens_neox': 888, 'n_words': 214}