Ask Your Question
0

Devstack on AWS and fetch data using pkgcloud.

asked 2017-02-08 08:58:01 -0600

sidIrisLogic gravatar image

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

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-01 08:03:56 -0600

sidIrisLogic gravatar image

The above was resolved, my authURL was not correct(oo man what a badiee) Anyway pkgcloud cannot be used for openstack deployed inside of AWS-EC2, reason as follows: 1. The createclient makes a call to fetch the authId and the service catalog. 2. The service catalog has the ip address endpoints pointing to an internally mapped IP allocated by AWS. 3. This ip is totally internal and private and not available. 4. So when pkgcloud extracts compute API endpoint and tries to call it , it times out,

 Error: connect ETIMEDOUT 10.140.196.48:8774{
        "message": "connect ETIMEDOUT 10.140.196.48:8774",
        "stack": "Error: connect ETIMEDOUT 10.140.196.48:8774\n    at Object.exports._errnoException (util.js:856:11)\n    at exports._exceptionWithHostPort (util.js:879:20)\n    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1057:14)",
        "code": "ETIMEDOUT",
        "errno": "ETIMEDOUT",
        "syscall": "connect",
        "address": "10.140.196.48",
        "port": 8774
}

Hence answering my own question :)

edit flag offensive delete link more

Comments

none the less pkgcloud works totally fine with trystack, no pun intended check links https://wangkexiong.github.io/using-openstack-api-with-trystack/ (https://wangkexiong.github.io/using-o...)

sidIrisLogic gravatar imagesidIrisLogic ( 2017-03-01 08:05:02 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2017-02-08 08:58:01 -0600

Seen: 144 times

Last updated: Mar 01 '17