nl_tokens: Handles becoming master .
pl_tokens: function becomeMaster ( provider , bigIp , <mask> ) { let hasUcs = false ; logger . info ( 'Becoming master.' ) ; logger . info ( 'Checking for backup UCS.' ) ; return provider . getStoredUcs ( ) . then ( ( response ) => { if ( response ) { hasUcs = true ; return loadUcs ( provider , bigIp , response , options . cloud ) ; } return q ( ) ; } ) . then ( ( ) => { // If we loaded UCS, re-initialize encryption so our keys // match each other if ( hasUcs ) { return initEncryption . call ( this , provider , bigIp ) ; } return q ( ) ; } ) . then ( ( ) => { return bigIp . list ( '/tm/sys/global-settings' ) ; } ) . then ( ( globalSettings ) => { const hostname = globalSettings ? globalSettings . hostname : undefined ; if ( hostname ) { this . instance . hostname = hostname ; } else { logger . debug ( 'hostname not found in this.instance or globalSettings' ) ; } return bigIp . list ( '/tm/sys/provision' ) ; } ) . then ( ( response ) => { const modulesProvisioned = { } ; if ( response && response . length > 0 ) { response . forEach ( ( module ) => { modulesProvisioned [ module . name ] = ! ( module . level === 'none' ) ; } ) ; } // Make sure device group exists logger . info ( 'Creating device group.' ) ; const deviceGroupOptions = { autoSync : options . autoSync , saveOnAutoSync : options . saveOnAutoSync , fullLoadOnSync : options . fullLoadOnSync , asmSync : modulesProvisioned . asm || options . asmSync , networkFailover : options . networkFailover } ; return bigIp . cluster . createDeviceGroup ( options . deviceGroup , 'sync-failover' , [ this . instance . hostname ] , deviceGroupOptions ) ; } ) . then ( ( ) => { logger . info ( 'Writing master file.' ) ; return writeMasterFile ( hasUcs ) ; } ) ; }