set boot device from given boot device
554864
def bootdevice(device, reboot = false, persistent = false)
      if config.bootdevices.include?(device)
        bootstatus = config.bootdevice(device, persistent)
        power.cycle if reboot && bootstatus
      else
        logger.error("Device with name: #{device} is not a valid boot device for host #{options['hostname']}") if logger
        raise "Device with name: #{device} is not a valid boot device for host #{options['hostname']}"
      end
    end
1201560
def cli(env, identifier):
    """"""

    mgr = SoftLayer.HardwareManager(env.client)
    hw_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'hardware')
    if not (env.skip_confirmations or
            formatting.confirm('This will power off the server with id %s and '
                               'reflash device firmware. Continue?' % hw_id)):
        raise exceptions.CLIAbort('Aborted.')

    mgr.reflash_firmware(hw_id)
535355
def init(opts):
    '''
    
    '''
    NETWORK_DEVICE.update(salt.utils.napalm.get_device(opts))
    DETAILS['initialized'] = True
    return True
1103284
def _is_boot_mode_uefi(self):
        
        boot_mode = self.get_current_boot_mode()
        return (boot_mode == BOOT_MODE_MAP.get(sys_cons.BIOS_BOOT_MODE_UEFI))
391261
def run_unlock(device_type, args):
    """"""
    util.setup_logging(verbosity=args.verbose)
    with device_type() as d:
        log.info('unlocked %s device', d)
701969
def apply(self, reboot=False):
        """"""
        self.root.use_virtual_addresses = True
        self.root.manage.manage = True
        self.root.mode = 'new'
        self.root.init_boot = reboot

        self.client.set_profile(self.root.get_json())
1038587
def get_persistent_boot_device(self):
        
        sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID)
        # Return boot device if it is persistent.
        if ((sushy_system.
             boot.enabled) == sushy.BOOT_SOURCE_ENABLED_CONTINUOUS):
            return PERSISTENT_BOOT_MAP.get(sushy_system.boot.target)
        # Check if we are in BIOS boot mode.
        # There is no resource to fetch boot device order for BIOS boot mode
        if not self._is_boot_mode_uefi():
            return None

        try:
            boot_device = (sushy_system.bios_settings.boot_settings.
                           get_persistent_boot_device())
            return PERSISTENT_BOOT_MAP.get(boot_device)
        except sushy.exceptions.SushyError as e:
            msg = (self._("The Redfish controller is unable to get "
                          "persistent boot device. Error %(error)s") %
                   {'error': str(e)})
            LOG.debug(msg)
            raise exception.IloError(msg)
897723
def is_boot_completed(self):
        """"""
        completed = self.adb.getprop('sys.boot_completed')
        if completed == '1':
            self.log.debug('Device boot completed.')
            return True
        return False
791170
def _switch_partition() -> RootPartitions:
    
    res = subprocess.check_output(['ot-switch-partitions'])
    for line in res.split(b'\n'):
        matches = re.match(
            b'Current boot partition: ([23]), setting to ([23])',
            line)
        if matches:
            return {b'2': RootPartitions.TWO,
                    b'3': RootPartitions.THREE}[matches.group(2)]
    else:
        raise RuntimeError(f'Bad output from ot-switch-partitions: {res}')
283890
def reboot(env, identifier, hard):
    """"""

    virtual_guest = env.client['Virtual_Guest']
    mgr = SoftLayer.HardwareManager(env.client)
    vs_id = helpers.resolve_id(mgr.resolve_ids, identifier, 'VS')
    if not (env.skip_confirmations or
            formatting.confirm('This will reboot the VS with id %s. '
                               'Continue?' % vs_id)):
        raise exceptions.CLIAbort('Aborted.')

    if hard is True:
        virtual_guest.rebootHard(id=vs_id)
    elif hard is False:
        virtual_guest.rebootSoft(id=vs_id)
    else:
        virtual_guest.rebootDefault(id=vs_id)
23013
def set_state(self, state, *, index=0):
        """"""
        return self.set_values({
            ATTR_DEVICE_STATE: int(state)
        }, index=index)
1225983
def set_pending_boot_mode(self, boot_mode):
        
        bios_properties = {
            'BootMode': mappings.GET_BIOS_BOOT_MODE_MAP_REV.get(boot_mode)
        }

        if boot_mode == sys_cons.BIOS_BOOT_MODE_UEFI:
            bios_properties['UefiOptimizedBoot'] = 'Enabled'

        self.update_bios_data_by_patch(bios_properties)
753449
def _post_init(self):
        """"""
        if WIN:
            self._find_devices_win()
        elif MAC:
            self._find_devices_mac()
        else:
            self._find_devices()
        self._update_all_devices()
        if NIX:
            self._find_leds()
1183473
def add_boot_info_table(self, boot_info_table):
        # type: (eltorito.EltoritoBootInfoTable) -> None
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Inode is not yet initialized')

        self.boot_info_table = boot_info_table
127104
def set_one_time_boot(self, value):
        
        dic = {'value': value}
        data = self._execute_command(
            'SET_ONE_TIME_BOOT', 'SERVER_INFO', 'write', dic)
        return data
176227
async def _set_state(self, state: int) -> bool:
        """"""
        try:
            set_state_resp = await self.api._request(
                'put',
                DEVICE_SET_ENDPOINT,
                json={
                    'attributeName': 'desireddoorstate',
                    'myQDeviceId': self.device_id,
                    'AttributeValue': state,
                })
        except RequestError as err:
            _LOGGER.error('%s: Setting state failed (and halting): %s',
                          self.name, err)
            return False

        if set_state_resp is None:
            return False

        if int(set_state_resp.get('ReturnCode', 1)) != 0:
            _LOGGER.error(
                '%s: Error setting the device state: %s', self.name,
                set_state_resp.get('ErrorMessage', 'Unknown Error'))
            return False

        return True
446526
function boot() {
  if (config === null) {
    // TODO [NSTDFRZN] Be sure nested objects are frozen too
    config = Object.freeze(gatherConfigFromEnv());
  }

  ee.emitAsync('booting_backing')
    .then(() => {
      ee.emit('booting');
      ee.emit('booted');
    })
    .catch((err) => {
      ee.emit('error', err); // TODO [ERR2BTERR] Maybe err -> BootError(err)
    });
}