influxdata / influxdb-python

Python client for InfluxDB
MIT License
1.7k stars 522 forks source link

Error creating buckets #904

Closed malwinweiler closed 3 years ago

malwinweiler commented 3 years ago

Dear Influx Team,

I am having a very strange issue with the buckets API that I cannot solve:

On my local machine (Win 10, Docker for Windows) everything works fine. I can create buckets without problems and see the changes immediately reflected in the DB.

However, on my Ubuntu host running the same docker container I am running into serious problems:

Error in creating bucket for influx1: list index out of range

def init_database(self, new_bucket, client):
    try:
        if self.bucket_api[client].find_bucket_by_name(new_bucket) != None:
            self.logger.debug(f'Bucket {new_bucket} already exists in InfluxDB, not changing anything')
        else:
            self.bucket_api[client].create_bucket(bucket_name=new_bucket)
            self.logger.info(f'Created Bucket {new_bucket} in InfluxDB')
        return new_bucket

    except Exception as err:
        self.logger.error('Error in creating bucket for {}: {}'.format(client, err))
        return None

new_bucket == "logs" client == "influx1" self.bucket_api[client] == <influxdb_client.client.bucket_api.BucketsApi object at 0x7fac51d4de20> self.bucket_api = dictionary object

The Error does not really make sense to me as there is no list being used in this code snippet, it is all dictionaries. I know that the _createbucket function causes the error but am unable to debug further into the code of the influxdb_client library.

Do you have any what causes this error?

Best regards and thanks in advance, M. Weiler

malwinweiler commented 3 years ago

Sorry, wrong github client library.