swift keystoneclient error “got an unexpected keyword argument 'insecure'”

Asked by parker

A week ago, i used a computer with swift and keystone well. today i want to set the same definition on another virtual machine.I got "TypeError: __init__() got an unexpected keyword argument 'insecure'", this time i got the new code from github.com.

$ swift -V 2.0 -A http://10.165.0.198:5000/v2.0 -U adminTenant:admin -K openstack stat
Traceback (most recent call last):
  File "/usr/local/bin/swift", line 5, in <module>
    pkg_resources.run_script('python-swiftclient==1.4.0', 'swift')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 499, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1235, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/EGG-INFO/scripts/swift", line 1331, in <module>
    error_queue)
  File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/EGG-INFO/scripts/swift", line 584, in st_stat
    headers = conn.head_account()
  File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/swiftclient/client.py", line 1053, in head_account
    return self._retry(None, head_account)
  File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/swiftclient/client.py", line 1022, in _retry
    self.url, self.token = self.get_auth()
  File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/swiftclient/client.py", line 1010, in get_auth
    insecure=self.insecure)
  File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/swiftclient/client.py", line 329, in get_auth
    insecure=insecure)
  File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/swiftclient/client.py", line 261, in get_keystoneclient_2_0
    auth_url=auth_url, insecure=insecure)
  File "/usr/lib/python2.7/dist-packages/keystoneclient/v2_0/client.py", line 66, in __init__
    super(Client, self).__init__(endpoint=endpoint, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'insecure'

my proxy-server.conf like this:

[DEFAULT]
bind_ip = 0.0.0.0
bind_port = 80
swift_dir = /etc/swift
workers = 1
user = swift
#cert_file = /etc/swift/cert.crt
#key_file = /etc/swift/cert.key
#log_name = swift
#log_facility = LOG_LOCAL0
#log_level = DEBUG

[pipeline:main]
pipeline = catch_errors healthcheck cache ratelimit authtoken keystone proxy-server
#pipeline = catch_errors healthcheck cache ratelimit tempauth proxy-server

[app:proxy-server]
use = egg:swift#proxy
account_autocreate = true
log_level = DEBUG

[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
#the host must point to your keystone server
auth_host = 10.165.0.198
auth_port = 35357
auth_protocol=http
service_host = 10.165.0.198
service_port = 5000
admin_token = ADMIN
admin_user = admin
admin_password = openstack
admin_tenant_name = demo

[filter:keystone]
paste.filter_factory = keystone.middleware.swift_auth:filter_factory
#use=egg:swift
operator_roles = adminRole, swiftoperator
#is_admin = true
#reseller_prefix=AUTH

[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3
[filter:healthcheck]
use = egg:swift#healthcheck

[filter:cache]
use = egg:swift#memcache
memcache_servers = 127.0.0.1:11211

[filter:ratelimit]
use = egg:swift#ratelimit

[filter:domain_remap]
use = egg:swift#domain_remap

[filter:catch_errors]
use = egg:swift#catch_errors

i use curl to test the keystone service. it works well!

curl -X POST -d '{"auth": {"tenantName": "demo", "passwordCredentials":{"username": "admin", "password": "openstack"}}}' -H "Content-type: application/json" http://10.165.0.198:5000/v2.0/tokens | python -mjson.tool

return like this:

  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 3229 100 3127 100 102 3577 116 --:--:-- --:--:-- --:--:-- 3627
{
    "access": {
        "metadata": {
            "is_admin": 0,
            "roles": [
                "b235307162ba4f6db870938e98f5c1c5",
                "9fe2ff9ee4384b1894a90878d3e92bab"
            ]
        },
        "serviceCatalog": [
            {
                "endpoints": [
                    {
                        "adminURL": "http://10.160.0.198/v1",
                        "id": "60cd73febcde4571b4f9dc41b7f93abb",
                        "internalURL": "http://10.160.0.198/v1/AUTH_b49d2bb8f91c48048eec7107eda11768",
                        "publicURL": "http://10.160.0.198/v1/AUTH_b49d2bb8f91c48048eec7107eda11768",
                        "region": "RegionOne"
                    }
                ],
                "endpoints_links": [],
                "name": "swift",
                "type": "object-store"
            },
        ],
        "token": {
            "expires": "2013-06-04T07:06:32Z",
            "id": “xxxx”
            "issued_at": "2013-06-03T07:06:32.571901",
            "tenant": {
                "description": "Demo Project",
                "enabled": true,
                "id": "b49d2bb8f91c48048eec7107eda11768",
                "name": "demo"
            }
        },
        "user": {
            "id": "2ecaf33a78f14ca09a54af8003e41d41",
            "name": "admin",
            "roles": [
                {
                    "name": "admin"
                },
                {
                    "name": "_member_"
                }
            ],
            "roles_links": [],
            "username": "admin"
        }
    }
}

when i turn to use tempauth, It works well, how can i do to fix it?

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Solved by:
Kun Huang
Solved:
Last query:
Last reply:
Revision history for this message
parker (juck78) said :
#1

i have solved this problem,but i don't know why,
i readed the log
File "/usr/local/lib/python2.7/dist-packages/python_swiftclient-1.4.0-py2.7.egg/swiftclient/client.py", line 261, in get_keystoneclient_2_0
    auth_url=auth_url, insecure=insecure)
i know something worng with the client.py
so i look for it,
_ksclient = ksclient.Client(username=user,
                                    password=key,
                                    tenant_name=os_options.get('tenant_name'),
                                    tenant_id=os_options.get('tenant_id'),
                                    debug=debug,
                                    cacert=kwargs.get('cacert'),
                                    auth_url=auth_url,insecure=insecure)
changed it to
_ksclient = ksclient.Client(username=user,
                                    password=key,
                                    tenant_name=os_options.get('tenant_name'),
                                    tenant_id=os_options.get('tenant_id'),
                                    #debug=debug,
                                    #cacert=kwargs.get('cacert'),
                                    #auth_url=auth_url,insecure=insecure)
                                    auth_url=auth_url)
it worked!,but i don't know why,anyone can help me ?

Revision history for this message
Best Kun Huang (academicgareth) said :
#2

The problems is in python-keystoneclient where is that Client ant its parent class define.

Your keystoneclient is not newest. Update your codes if you could use master branch

I have a simple scan of keystoneclient and find that in an old version the Client.__init__ doesn't use insecure keyword. So have a try to updating your keystoneclient.

Revision history for this message
parker (juck78) said :
#3

Thanks Kun Huang, that solved my question.