@@ -14,7 +14,7 @@ import Installer from './helpers/installer';
1414import Util from './helpers/util.js' ;
1515
1616class CDKInstall extends InstallableItem {
17- constructor ( installerDataSvc , $timeout , cdkUrl , cdkBoxUrl , ocUrl , installFile , targetFolderName ) {
17+ constructor ( installerDataSvc , $timeout , cdkUrl , cdkBoxUrl , ocUrl , installFile , targetFolderName , ocSha256 ) {
1818 super ( 'cdk' ,
1919 900 ,
2020 cdkUrl ,
@@ -25,6 +25,7 @@ class CDKInstall extends InstallableItem {
2525 this . $timeout = $timeout ;
2626 this . cdkBoxUrl = cdkBoxUrl ;
2727 this . ocUrl = ocUrl ;
28+ this . ocSha256 = ocSha256 ;
2829
2930 this . cdkFileName = 'cdk.zip' ;
3031 this . cdkDownloadedFile = path . join ( this . installerDataSvc . tempDir ( ) , this . cdkFileName ) ;
@@ -45,8 +46,8 @@ class CDKInstall extends InstallableItem {
4546 return 'cdk' ;
4647 }
4748
48-
49- checkForExistingInstall ( ) {
49+ detectExistingInstall ( cb = new function ( ) { } ) {
50+ cb ( ) ;
5051 }
5152
5253 downloadInstaller ( progress , success , failure ) {
@@ -61,26 +62,16 @@ class CDKInstall extends InstallableItem {
6162 if ( ! fs . existsSync ( path . join ( this . downloadFolder , this . boxName ) ) ) {
6263 let cdkBoxWriteStream = fs . createWriteStream ( this . cdkBoxDownloadedFile ) ;
6364 this . downloader . setWriteStream ( cdkBoxWriteStream ) ;
64- this . downloader . download ( this . cdkBoxUrl ) ;
65+ this . downloader . downloadAuth ( this . cdkBoxUrl , username , password ) ;
6566 } else {
6667 this . cdkBoxDownloadedFile = path . join ( this . downloadFolder , this . boxName ) ;
6768 this . downloader . closeHandler ( ) ;
6869 }
6970
7071 if ( ! fs . existsSync ( path . join ( this . downloadFolder , this . cdkFileName ) ) ) {
71- // TODO Switch back to auth download when CDK latest is in Customer Portal
72- // downloader.downloadAuth
73- // ({
74- // url: this.cdkBoxUrl,
75- // rejectUnauthorized: false
76- // }, username, password);
7772 let cdkWriteStream = fs . createWriteStream ( this . cdkDownloadedFile ) ;
7873 this . downloader . setWriteStream ( cdkWriteStream ) ;
79- this . downloader . downloadAuth
80- ( {
81- url : this . getDownloadUrl ( ) ,
82- rejectUnauthorized : false
83- } , username , password ) ;
74+ this . downloader . downloadAuth ( this . getDownloadUrl ( ) , username , password ) ;
8475 } else {
8576 this . cdkDownloadedFile = path . join ( this . downloadFolder , this . cdkFileName ) ;
8677 this . downloader . closeHandler ( ) ;
@@ -89,7 +80,7 @@ class CDKInstall extends InstallableItem {
8980 if ( ! fs . existsSync ( path . join ( this . downloadFolder , this . ocFileName ) ) ) {
9081 let ocWriteStream = fs . createWriteStream ( this . ocDownloadedFile ) ;
9182 this . downloader . setWriteStream ( ocWriteStream ) ;
92- this . downloader . download ( this . ocUrl ) ;
83+ this . downloader . download ( this . ocUrl , this . ocDownloadedFile , this . ocSha256 ) ;
9384 } else {
9485 this . ocDownloadedFile = path . join ( this . downloadFolder , this . ocFileName ) ;
9586 this . downloader . closeHandler ( ) ;
0 commit comments