Isilon / isilon_sdk_python

Official generated source of the Isilon SDK Python language bindings.
36 stars 33 forks source link

QuotaApi.get_quota_report returns None #8

Closed jbd closed 6 years ago

jbd commented 6 years ago

Hello,

I can run:

$ curl -H 'Accept: application/json; indent=4' -s --insecure -b @cookie "https://ISILON:8080/platform/1/quota/reports/1533808800-scheduled-detail" | head -n 3
<?xml version="1.0" ?>
<quota-report time="1533808800">
    <global-config>
        <quota-global-config>
            <reports>
                <schedule-pattern>1398258051|every 1 days at 12:00 PM</schedule-pattern>
                <schedule-dir>/ifs/.isilon/smartquotas/reports</schedule-dir>
                <schedule-copies>365</schedule-copies>
                <adhoc-dir>/ifs/.isilon/smartquotas/reports</adhoc-dir>
                <adhoc-copies>365</adhoc-copies>

But I can't get QuotaApi.get_quota_report working:

$ cat bug.py 
from __future__ import print_function
import time
import os
import sys
from pprint import pprint

import isi_sdk_8_0_1 as isi_sdk
from isi_sdk_8_0_1.rest import ApiException

def print_error(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

def main():
    # Configure HTTP basic authorization: basicAuth
    configuration = isi_sdk.Configuration()
    # configure username and password
    configuration.username = os.getenv("ISI_ONEFS_USER")
    configuration.password = os.getenv("ISI_ONEFS_PASS")
    configuration.host = os.getenv("ISI_ONEFS_HOST")

    if not all((configuration.username, configuration.password, configuration.host)):
        print_error("You must provide ISI_ONEFS_USER, ISI_ONEFS_PASS and ISI_ONEFS_HOST environment variable")
        sys.exit(42)

    configuration.verify_ssl = os.getenv("ISI_ONEFS_VERIFYSSL")

    if not configuration.verify_ssl:
        import urllib3
        urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

    # create an instance of the API class
    api_client = isi_sdk.ApiClient(configuration)
    api_instance = isi_sdk.QuotaApi(api_client)

    print("list_quota_reports:", api_instance.list_quota_reports(sort="time", generated="scheduled", type="detail", dir="DESC", limit=1))
    print("get_quota_report 1533808800-scheduled-detail:", api_instance.get_quota_report("1533808800-scheduled-detail"))

main()

This outputs:

list_quota_reports: {'reports': [{'generated': 'scheduled',
              'id': '1533808800-scheduled-detail',
              'time': 1533808800,
              'type': 'detail'}],
 'resume': '1-1-MQAA1-MAAA1-MQAA1-MAAA1-MQAA27-MTUzMzgwODgwMC1zY2hlZHVsZWQtZGV0YWls',
 'total': 365}
get_quota_report 1533808800-scheduled-detail: {'reports': None}
$ isi version
Isilon OneFS v8.0.0.6 B_MR_8_0_0_6_117(RELEASE): 0x800005000600075:Wed Nov  1 13:36:44 PDT 2017    root@sea-build10-105:/b/mnt/obj/b/mnt/src/sys/IQ.amd64.release   FreeBSD clang version 3.3 (tags/RELEASE_33/final 183502) 20130610

Any idea ? Maybe I'm just not using the API correctly ?

jbd commented 6 years ago

Mmmm. This is working.

api_instance.list_quota_quotas(report_id='1533808800-scheduled-detail')

I didn't understand how to use the API. You can close.