now prperly pulling an image
This commit is contained in:
parent
6b22f12051
commit
0575e618f2
23
dist/dockersock.classes.dockersock.js
vendored
23
dist/dockersock.classes.dockersock.js
vendored
File diff suppressed because one or more lines are too long
@ -25,8 +25,8 @@ describe("dockersock", function () {
|
||||
});
|
||||
});
|
||||
it("should pull an image from imagetag", function (done) {
|
||||
this.timeout(10000);
|
||||
testDockersock.pullImage("nginx")
|
||||
this.timeout(30000);
|
||||
testDockersock.pullImage("hosttoday%2Fht-docker-dbase")
|
||||
.then(function (dataArg) {
|
||||
done();
|
||||
}, done);
|
||||
@ -34,4 +34,4 @@ describe("dockersock", function () {
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUVQLENBQUMsQ0FGYztBQUVmLHNCQUF5QixlQUV6QixDQUFDLENBRnVDO0FBRXhDLFFBQVEsQ0FBQyxZQUFZLEVBQUM7SUFDbEIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixJQUFJLGNBQXlCLENBQUM7UUFDOUIsRUFBRSxDQUFDLHlDQUF5QyxFQUFDO1lBQ3pDLGNBQWMsR0FBRyxJQUFJLGtCQUFVLEVBQUUsQ0FBQztZQUNsQyxjQUFjLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsa0JBQVUsQ0FBQyxDQUFDO1FBQ3BELENBQUMsQ0FBQyxDQUFDO1FBQ0gsRUFBRSxDQUFDLHdCQUF3QixFQUFDLFVBQVMsSUFBSTtZQUNyQyxjQUFjLENBQUMsY0FBYyxFQUFFO2lCQUMxQixJQUFJLENBQUMsVUFBQyxPQUFPO2dCQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsT0FBTyxDQUFDLENBQUM7Z0JBQ3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9ja2Vyc29jaztcbiAgICAgICAgaXQoXCJzaG91bGQgY3JlYXRlIGEgbmV3IERvY2tlcnNvY2sgaW5zdGFuY2VcIixmdW5jdGlvbigpe1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2sgPSBuZXcgRG9ja2Vyc29jaygpO1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2suc2hvdWxkLmJlLmluc3RhbmNlb2YoRG9ja2Vyc29jayk7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCBsaXN0IGNvbnRhaW5lcnNcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgIHRlc3REb2NrZXJzb2NrLmxpc3RDb250YWluZXJzKClcbiAgICAgICAgICAgICAgICAudGhlbigoZGF0YUFyZyk9PntcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZGF0YUFyZyk7XG4gICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGl0KFwic2hvdWxkIGxpc3QgZGV0YWlsZWQgY29udGFpbmVyc1wiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgdGhpcy50aW1lb3V0KDUwMDApO1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2subGlzdENvbnRhaW5lcnNEZXRhaWxlZCgpXG4gICAgICAgICAgICAgICAgLnRoZW4oKGRhdGFBcmcpPT57XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKGRhdGFBcmcpO1xuICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgIH0pO1xuICAgICAgICBpdChcInNob3VsZCBwdWxsIGFuIGltYWdlIGZyb20gaW1hZ2V0YWdcIixmdW5jdGlvbihkb25lKXtcbiAgICAgICAgICAgIHRoaXMudGltZW91dCgxMDAwMCk7XG4gICAgICAgICAgICB0ZXN0RG9ja2Vyc29jay5wdWxsSW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9ja2Vyc29jay5zaG91bGQuYmUuaW5zdGFuY2VvZihEb2NrZXJzb2NrKTtcbiAgICAgICAgfSk7XG4gICAgICAgIGl0KFwic2hvdWxkIGxpc3QgY29udGFpbmVyc1wiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgdGVzdERvY2tlcnNvY2subGlzdENvbnRhaW5lcnMoKVxuICAgICAgICAgICAgICAgIC50aGVuKChkYXRhQXJnKT0+e1xuICAgICAgICAgICAgICAgICAgICBjb25zb2xlLmxvZyhkYXRhQXJnKTtcbiAgICAgICAgICAgICAgICAgICAgZG9uZSgpO1xuICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgICAgaXQoXCJzaG91bGQgbGlzdCBkZXRhaWxlZCBjb250YWluZXJzXCIsZnVuY3Rpb24oZG9uZSl7XG4gICAgICAgICAgICB0aGlzLnRpbWVvdXQoNTAwMCk7XG4gICAgICAgICAgICB0ZXN0RG9ja2Vyc29jay5saXN0Q29udGFpbmVyc0RldGFpbGVkKClcbiAgICAgICAgICAgICAgICAudGhlbigoZGF0YUFyZyk9PntcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coZGF0YUFyZyk7XG4gICAgICAgICAgICAgICAgICAgIGRvbmUoKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIGl0KFwic2hvdWxkIHB1bGwgYW4gaW1hZ2UgZnJvbSBpbWFnZXRhZ1wiLGZ1bmN0aW9uKGRvbmUpe1xuICAgICAgICAgICAgdGhpcy50aW1lb3V0KDMwMDAwKTtcbiAgICAgICAgICAgIHRlc3REb2NrZXJzb2NrLnB1bGxJbWFnZShcImhvc3R0b2RheSUyRmh0LWRvY2tlci1kYmFzZVwiKVxuICAgICAgICAgICAgICAgIC50aGVuKChkYXRhQXJnKT0+e1xuICAgICAgICAgICAgICAgICAgICBkb25lKCk7XG4gICAgICAgICAgICAgICAgfSxkb25lKTtcbiAgICAgICAgfSlcbiAgICB9KTtcbn0pOyJdfQ==
|
||||
|
@ -26,8 +26,8 @@ describe("dockersock",function(){
|
||||
});
|
||||
});
|
||||
it("should pull an image from imagetag",function(done){
|
||||
this.timeout(10000);
|
||||
testDockersock.pullImage("nginx")
|
||||
this.timeout(30000);
|
||||
testDockersock.pullImage("hosttoday%2Fht-docker-dbase")
|
||||
.then((dataArg)=>{
|
||||
done();
|
||||
},done);
|
||||
|
@ -111,20 +111,22 @@ export class Dockersock {
|
||||
requestStream(methodArg,routeArg,endArg:boolean = true){
|
||||
let done = plugins.q.defer();
|
||||
if(methodArg == "POST"){
|
||||
let requestStream = plugins.request.post(this.sockPath + routeArg)
|
||||
.on("response",(response) => {
|
||||
let requestStream = plugins.request.post(this.sockPath + routeArg);
|
||||
requestStream.on("response",(response) => {
|
||||
if(response.statusCode == 200){
|
||||
if(endArg == true){
|
||||
console.log("ending request");
|
||||
response.emit("end");
|
||||
} else {
|
||||
console.log("streaming forever");
|
||||
}
|
||||
done.resolve(response);
|
||||
plugins.beautylog.ok("request returned status 200, so we are good!");
|
||||
} else {
|
||||
plugins.beautylog.error("request returned error: " + response.statusCode);
|
||||
done.reject();
|
||||
}
|
||||
})
|
||||
});
|
||||
requestStream.on("data",(data:Buffer) => {
|
||||
let status = JSON.parse(data.toString()).status;
|
||||
plugins.beautylog.log(status);
|
||||
});
|
||||
requestStream.on("end",()=> {
|
||||
done.resolve();
|
||||
});
|
||||
}
|
||||
return done.promise;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user