Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Devstack on AWS and fetch data using pkgcloud.

Hi, I have installed DevStack on a m3.large instance of AWS-EC2 and the installation went smoothly and I did not get any errors. Now I am using the node-js based pkgcloud sdk to fetch data from it but it is erroring out, Could someone please point out what I am doing wrong or where do I need to look or change something to get this working.

I am pasting the code and the error below

var pkgcloud = require('pkgcloud');
var openstack = pkgcloud.compute.createClient({
    provider: 'openstack',
    username: 'myusername',
    password: 'mypassword',
    region: 'nova',
    tenantId: 'admin',
    authUrl: 'http://ip-address/identity'
});
//console.log("openstack "+JSON.stringify(openstack,null,'\t'))
openstack.getServers(function(err, containers) {
    if (err)
        console.log("Err " + err + JSON.stringify(err, null, '\t'));
    else
        console.log("Servers " + JSON.stringify(containers, null, '\t'));
})

The Error that I get is this:

Error: Error (401): Unauthorized{
        "message": "Error (401): Unauthorized",
        "stack": "Error: Error (401): Unauthorized\n    at Object.exports.handle (D:\\Siddharth\\30.Sublime-workspace\\openstack-poc\\node_modules\\errs\\lib\\errs.js:203:19)\n    at D:\\Siddharth\\30.Sublime-workspace\\openstack-poc\\node_modules\\pkgcloud\\lib\\pkgcloud\\openstack\\client.js:214:23\n    at D:\\Siddharth\\30.Sublime-workspace\\openstack-poc\\node_modules\\pkgcloud\\lib\\pkgcloud\\openstack\\client.js:162:14\n    at Request._callback (D:\\Siddharth\\30.Sublime-workspace\\openstack-poc\\node_modules\\pkgcloud\\lib\\pkgcloud\\openstack\\context\\identity.js:160:14)\n    at Request.self.callback (D:\\Siddharth\\30.Sublime-workspace\\openstack-poc\\node_modules\\request\\request.js:123:22)\n    at emitTwo (events.js:100:13)\n    at Request.emit (events.js:185:7)\n    at Request.<anonymous> (D:\\Siddharth\\30.Sublime-workspace\\openstack-poc\\node_modules\\request\\request.js:1047:14)\n    at emitOne (events.js:95:20)",
        "name": "Error",
        "failCode": "Unauthorized",
        "statusCode": 401,
        "href": "http://54.227.13.130/identity/v2.0/tokens",
        "method": "POST",
        "headers": {
                "date": "Wed, 08 Feb 2017 14:34:34 GMT",
                "server": "Apache/2.4.18 (Ubuntu)",
                "vary": "X-Auth-Token",
                "x-openstack-request-id": "req-be91d3cf-40f9-4c50-9c2b-7d9eb4fcb313",
                "www-authenticate": "Keystone uri=\"http://10.140.196.48/identity\"",
                "content-length": "114",
                "connection": "close",
                "content-type": "application/json"
        },
        "result": {
                "error": {
                        "message": "The request you have made requires authentication.",
                        "code": 401,
                        "title": "Unauthorized"
                }
        }
}

The same credentials work when I login using the web based interface, but here I get 401, I am kinda stuck any help would really be appreciated.

Thanks Siddharth