nl_tokens: Handles -- cluster - action join
pl_tokens: function handleJoin ( provider , bigIp , masterIid , options ) { const deferred = q . defer ( ) ; logger . info ( 'Cluster action JOIN' ) ; logger . info ( 'Initializing encryption' ) ; initEncryption . call ( this , provider , bigIp ) . then ( ( ) => { let promise ; // If we are master and are replacing an expired master, other instances // will join to us. Just set our config sync ip. if ( this . instance . isMaster ) { if ( ! provider . hasFeature ( CloudProvider . FEATURE_MESSAGING ) ) { logger . info ( 'Storing master credentials.' ) ; promise = provider . putMasterCredentials ( ) ; } else { promise = q ( ) ; } promise . then ( ( response ) => { logger . debug ( response ) ; // Configure cm configsync-ip on this BIG-IP node if ( ! options . blockSync ) { logger . info ( 'Setting config sync IP.' ) ; return bigIp . cluster . configSyncIp ( this . instance . privateIp ) ; } logger . <mask> ( 'Not seting config sync IP because block-sync is specified.' ) ; return q ( ) ; } ) . then ( ( ) => { deferred . resolve ( ) ; } ) . catch ( ( err ) => { // rethrow here, otherwise error is hidden throw err ; } ) ; } else { // We're not the master // Make sure the master file is not on our disk if ( fs . existsSync ( MASTER_FILE_PATH ) ) { fs . unlinkSync ( MASTER_FILE_PATH ) ; } // Configure cm configsync-ip on this BIG-IP node and join the cluster logger . info ( 'Setting config sync IP.' ) ; bigIp . cluster . configSyncIp ( this . instance . privateIp ) . then ( ( ) => { // If there is a master, join it. Otherwise wait for an update event // when we have a master. if ( masterIid ) { return joinCluster . call ( this , provider , bigIp , masterIid , options ) ; } return q ( ) ; } ) . then ( ( ) => { deferred . resolve ( ) ; } ) . catch ( ( err ) => { // rethrow here, otherwise error is hidden throw err ; } ) ; } } ) ; return deferred . promise ; }