File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,11 @@ provisioner.start('test').then((serverInfo: any) => {
2222 log . info ( 'server provisioned: %1' , serverInfo ) ;
2323
2424 const installer = freedom [ 'cloudinstall' ] ( ) ;
25+
26+ installer . on ( 'progress' , ( progress : number ) => {
27+ log . info ( 'install progress: %1' , progress ) ;
28+ } ) ;
29+
2530 log . info ( 'installing...' ) ;
2631 installer . install ( serverInfo . network . ipv4 , serverInfo . network . ssh_port ,
2732 'root' , serverInfo . ssh . private ) . then ( ( invitation : string ) => {
Original file line number Diff line number Diff line change 1717 },
1818 "err" : {
1919 "message" : " string"
20+ },
21+ "progress" : {
22+ "type" : " event" ,
23+ "value" : " number"
24+ },
25+ "status" : {
26+ "type" : " event" ,
27+ "value" : " string"
2028 }
2129 }
2230 },
Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ const INSTALL_COMMAND = 'curl -sSL https://raw.githubusercontent.com/uProxy/upro
2020// Prefix for invitation URLs.
2121const INVITATION_PREFIX = 'CLOUD_INSTANCE_DETAILS_JSON:' ;
2222
23+ // Prefix for progress updates.
24+ const PROGRESS_PREFIX = 'CLOUD_INSTALL_PROGRESS' ;
25+
26+ // Prefix for status updates.
27+ const STATUS_PREFIX = 'CLOUD_INSTALL_STATUS' ;
28+
2329// Installs uProxy on a server, via SSH.
2430// The process is as close as possible to a manual install
2531// so that we have fewer paths to test.
@@ -65,6 +71,16 @@ class CloudInstaller {
6571 message : 'could not parse invite: ' + inviteJson
6672 } ) ;
6773 }
74+ } else if ( line . indexOf ( PROGRESS_PREFIX ) === 0 ) {
75+ const tokens = line . split ( ' ' ) ;
76+ if ( tokens . length < 2 ) {
77+ log . warn ( 'could not parse progress update' ) ;
78+ } else {
79+ const progress = parseInt ( tokens [ 1 ] , 10 ) ;
80+ this . dispatchEvent_ ( 'progress' , progress ) ;
81+ }
82+ } else if ( line . indexOf ( STATUS_PREFIX ) === 0 ) {
83+ this . dispatchEvent_ ( 'status' , line ) ;
6884 }
6985 } ) ;
7086
You can’t perform that action at this time.
0 commit comments