Code Monkey home page Code Monkey logo

python-ecsclient's Issues

Ability to create data stores and VDCs

Check and add tests for the data store endpoint. Also make sure it can create new VDCs. Since it's not documented in the API, review how it's done in the CLI and ECS CE step 2 script.

Python module to do Object operations

Is there an equivalent Python Module to List objects in a given bucket ;
GET
retrieve object
retrieve object’s metadata
retrieve object’s ACLs

PUT, POST, DELETE method as well.

`management_users` results in 400 Bad Request errors

Depends on #12

    conf.api_client.management_user.create_local_user_info(name, mu_pass, **mu_dict)
  File "/usr/local/lib/python2.7/site-packages/ecsclient/common/user_management/management_user.py", line 42, in create_local_user_info
    return self.conn.post(url='vdc/users', json_payload=payload)
  File "/usr/local/lib/python2.7/site-packages/ecsclient/baseclient.py", line 111, in post
    return self._request(url, json_payload, http_verb='POST')
  File "/usr/local/lib/python2.7/site-packages/ecsclient/baseclient.py", line 160, in _request
    raise ECSClientException.from_response(req)
ecsclient.common.exceptions.ECSClientException: Unrecognized field "user" (Class com.emc.storageos.data.datasvcmodels.mgmtuserinfo.MgmtUserInfoCreate), not marked as ignorable
 at [Source: HttpInputOverHTTP@5254f7cd[c=95,s=STREAM]; line: 1, column: 35] (through reference chain: com.emc.storageos.data.datasvcmodels.mgmtuserinfo.MgmtUserInfoCreate["user"]) - Bad request body: https://192.168.2.220:4443/vdc/users 400 Bad Request  [first 60 chars of response] {"code":1013,"retryable":false,"description":"Bad request bo

For reference, the values passed to api_client.management_user.create_local_user_info(name, mu_pass, **mu_dict) are:

name = "user1"
mu_pass = "ChangeMe"
mu_dict = {'is_system_monitor': False, 'is_system_admin': False}

Let me know what other data you'd like to help troubleshooting.

Create a CLI

Create a command line utility to enable users to use this library from the terminal and automate it in shell scripts.

Error when creating a data store in ECS 3.1

The API has changed in 3.1 and it fails to create data store given an IP address. It should instead use a node ID.

Error output:

> Adding Data Stores to Storage Pool:
>       vdc1/sp1/192.168.2.220
Traceback (most recent call last):
  File "/usr/local/bin/ecsconfig", line 11, in <module>
    load_entry_point('ecsdeploy==2.4.0', 'console_scripts', 'ecsconfig')()
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1092, in invoke
    rv.append(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/bin/ecsconfig.py", line 637, in sp
    tasks = add_all()
  File "/usr/local/bin/ecsconfig.py", line 613, in add_all
    sp_tasks.extend(add_one(name))
  File "/usr/local/bin/ecsconfig.py", line 605, in add_one
    sp_tasks.append(sp_add_node(sp_id, node))
  File "/usr/local/bin/ecsconfig.py", line 582, in sp_add_node
    return conf.api_client.data_store.create(**kwargs)
  File "/usr/local/lib/python2.7/site-packages/ecsclient/common/provisioning/data_store.py", line 217, in create
    return self.conn.post('vdc/data-stores/commodity', json_payload=payload)
  File "/usr/local/lib/python2.7/site-packages/ecsclient/baseclient.py", line 120, in post
    return self._request(url, json_payload, http_verb='POST')
  File "/usr/local/lib/python2.7/site-packages/ecsclient/baseclient.py", line 170, in _request
    raise ECSClientException.from_response(req)
ecsclient.common.exceptions.ECSClientException: Usage of node IP address in place of nodeId is no longer supported - Api Parameter Node Id Invalid: https://192.168.2.220:4443/vdc/data-stores/commodity 400 Bad Request  [first 60 chars of response] {"code":1050,"retryable":false,"description":"Api Parameter

Create a utilities class

Create a utilities class with functions for users to validate responses and other useful utilities.

Example for validating a response:

from ecsclient import util, schemas
util.is_valid_response(response, schemas.LICENSE)

Issues in exceptions.py

Fedor: who is supporting python client? Code in client:

        a = self.message
        if self.ecs_details not in a:
            a += ' - %s' % self.ecs_details
        if self.ecs_description not in a:
            a += ' - %s' % self.ecs_description
        b = ''
        if self.http_scheme:
            b += '%s://' % self.http_scheme
        if self.http_host:
            b += self.http_host
        if self.http_port:
            b += ':%s' % self.http_port
        if self.http_path:
            b += self.http_path
        if self.http_query:
            b += '?%s' % self.http_query
        if self.http_status:
            if b:
                b = '%s %s' % (b, self.http_status)
            else:
                b = str(self.http_status)
        if self.http_reason:
            if b:
                b = '%s %s' % (b, self.http_reason)
            else:
                b = '- %s' % self.http_reason
        if self.http_response_content:
            if len(self.http_response_content) <= 60:
                b += '   %s' % self.http_response_content
            else:
                b += '  [first 60 chars of response] %s' \
                     % self.http_response_content[:60]
        return b and '%s: %s' % (a, b) or a```
Fedor: https://github.com/EMCECS/python-ecsclient/blob/master/ecsclient/common/exceptions.py#L72
Fedor: It's creating new exceptions)
Fedor: every exception raising use it
Fedor: and `first 60 chars of response` is too small. I think we should increase size of message. It's just logs, so I don't understand why client needs to cut messages

Create Bucket

Am getting error while using
client.bucket.create(bucket_name='bucket-test1', replication_group='REP-ECS', namespace='namespace1')

File "", line 1, in
File "ecs.py", line 244, in create_bucket
status = self.client.bucket.create(bucket_name, replication_group, namespace)
File "/ecsclient/common/provisioning/bucket.py", line 85, in create
return self.conn.post('object/bucket', json_payload=payload)
File "/ecsclient/baseclient.py", line 120, in post
return self._request(url, json_payload, http_verb='POST')
File "/ecsclient/baseclient.py", line 170, in _request
raise ECSClientException.from_response(req)
ecs.ExecutionError: Can not construct instance of java.lang.Boolean from String value 'ess_aut_ns': only "true" or "false" recognized
at [Source: HttpInputOverHTTP@7025d20c[c=153,s=STREAM]; line: 1, column: 2] (through reference chain: com.emc.storageos.data.datasvcmodels.bucket.ObjectBucketParam["filesystem_enabled"]) - Bad request

Create Bucket when compliance enabled fails

We have a requirement to create some namespaces with compliance enabled but I noted when attempting to create buckets in those namespaces using ecsclient an error is returned stating that "Incorrect retention parameter: bucket retention period must be set if retention enforcement is off".

On checking I see that under ecsclient.common.provisioning.bucket the create under the Bucket class does not support specifying retention as specified int he REST API guide for ECS - is there supposed to be another way around this (i.e. am I doing it wrong - probably yes is the answer :) ) As there is a function to alter retention post bucket creation I had assumed that you'd be able to create the bucket and then modify retention but no such luck.

Upon modifying bucket.py to allow for specification of retention the bucket is able to be created successfully and specifying a retention of 0 seems as the default also seems to allow for non-compliance buckets to be created without issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.