Initialize global settings for DN
972440
protected void initGlobalSetting(Configuration conf,
      AbstractList<File> dataDirs) throws IOException {
    this.dataDirs = dataDirs;
    this.conf = conf;
    storage = new DataStorage(this);
    
    // global DN settings
    initConfig(conf);
    registerMXBean();
    initDataXceiver(conf);
    startInfoServer(conf);
    initIpcServer(conf);

    myMetrics = new DataNodeMetrics(conf, storage.getStorageID());
    setCountingLoggers(myMetrics);
    threadLivenessReporter = new DatanodeThreadLivenessReporter(conf.getLong(
        "dfs.datanode.thread.liveness.threshold", 240 * 1000),
        myMetrics.threadActiveness);
  }
264732
public void setGlobal(int pathId, Boolean global) {
        PreparedStatement statement = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            statement = sqlConnection.prepareStatement(
                "UPDATE " + Constants.DB_TABLE_PATH +
                    " SET " + Constants.PATH_PROFILE_GLOBAL + " = ? " +
                    " WHERE " + Constants.GENERIC_ID + " = ?"
            );
            statement.setBoolean(1, global);
            statement.setInt(2, pathId);
            statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
998770
function(params) {
			$.extend(globalConfig, params || {});

			this.startAll(document.documentElement);

			this.fire('init');
			initialized = true;
		}
870721
def network_configuration
      dns = settings.provider.network.dns
      dns = dns.split(",") if dns.is_a?(String)
      {
        "ip"=>public_ip,
        "netmask"=>settings.provider.network.netmask,
        "gateway"=>settings.provider.network.gateway,
        "dns"=>dns,
        "cloud_properties"=>{
          "name"=>settings.provider.network.name
        }
      }
    end
739750
public function Setup() {
      $Database = Gdn::Database();
      $Config = Gdn::Factory(Gdn::AliasConfig);
      $Drop = C('Conversations.Version') === FALSE ? TRUE : FALSE;
      $Explicit = TRUE;
      $Validation = new Gdn_Validation(); // This is going to be needed by structure.php to validate permission names
      include(PATH_APPLICATIONS . DS . 'conversations' . DS . 'settings' . DS . 'structure.php');
      include(PATH_APPLICATIONS . DS . 'conversations' . DS . 'settings' . DS . 'stub.php');

      $ApplicationInfo = array();
      include(CombinePaths(array(PATH_APPLICATIONS . DS . 'conversations' . DS . 'settings' . DS . 'about.php')));
      $Version = ArrayValue('Version', ArrayValue('Conversations', $ApplicationInfo, array()), 'Undefined');
      SaveToConfig('Conversations.Version', $Version);
   }
993452
function init(domainManager) {
    _domainManager = domainManager;

    if (!domainManager.hasDomain("staticServer")) {
        domainManager.registerDomain("staticServer", {major: 0, minor: 1});
    }
    _domainManager.registerCommand(
        "staticServer",
        "_setRequestFilterTimeout",
        _cmdSetRequestFilterTimeout,
        false,
        "Unit tests only. Set timeout value for filtered requests.",
        [{
            name: "timeout",
            type: "number",
            description: "Duration to wait before passing a filtered request to the static file server."
        }],
        []
    );
    _domainManager.registerCommand(
        "staticServer",
        "getServer",
        _cmdGetServer,
        true,
        "Starts or returns an existing server for the given path.",
        [
            {
                name: "path",
                type: "string",
                description: "Absolute filesystem path for root of server."
            },
            {
                name: "port",
                type: "number",
                description: "Port number to use for HTTP server.  Pass zero to assign a random port."
            }
        ],
        [{
            name: "address",
            type: "{address: string, family: string, port: number}",
            description: "hostname (stored in 'address' parameter), port, and socket type (stored in 'family' parameter) for the server. Currently, 'family' will always be 'IPv4'."
        }]
    );
    _domainManager.registerCommand(
        "staticServer",
        "closeServer",
        _cmdCloseServer,
        false,
        "Closes the server for the given path.",
        [{
            name: "path",
            type: "string",
            description: "absolute filesystem path for root of server"
        }],
        [{
            name: "result",
            type: "boolean",
            description: "indicates whether a server was found for the specific path then closed"
        }]
    );
    _domainManager.registerCommand(
        "staticServer",
        "setRequestFilterPaths",
        _cmdSetRequestFilterPaths,
        false,
        "Defines a set of paths from a server's root path to watch and fire 'requestFilter' events for.",
        [
            {
                name: "root",
                type: "string",
                description: "absolute filesystem path for root of server"
            },
            {
                name: "paths",
                type: "Array",
                description: "path to notify"
            }
        ],
        []
    );
    _domainManager.registerCommand(
        "staticServer",
        "writeFilteredResponse",
        _cmdWriteFilteredResponse,
        false,
        "Overrides the server response from static middleware with the provided response data. This should be called only in response to a filtered request.",
        [
            {
                name: "root",
                type: "string",
                description: "absolute filesystem path for root of server"
            },
            {
                name: "path",
                type: "string",
                description: "path to rewrite"
            },
            {
                name: "resData",
                type: "{body: string, headers: Array}",
                description: "TODO"
            }
        ],
        []
    );
    _domainManager.registerEvent(
        "staticServer",
        "requestFilter",
        [{
            name: "location",
            type: "{hostname: string, pathname: string, port: number, root: string: id: number}",
            description: "request path"
        }]
    );
}
1373147
def _set_fqdn(self):
        """"""
        results = self._search(
            'cn=config',
            '(objectClass=*)',
            ['nsslapd-localhost'],
            scope=ldap.SCOPE_BASE
        )
        if not results and type(results) is not list:
            r = None
        else:
            dn, attrs = results[0]
            r = attrs['nsslapd-localhost'][0].decode('utf-8')
        self._fqdn = r
        log.debug('FQDN: %s' % self._fqdn)
1252127
private function initServerGlobal()
    {

        $entryUrl = $this->config['entryUrl'];
        $entryFile = $this->config['entryScript'] ?: basename($entryUrl);
        $entryScript = $this->config['entryScript'] ?: parse_url($entryUrl, PHP_URL_PATH);
        $_SERVER = array_merge($_SERVER, [
            'SCRIPT_FILENAME' => $entryFile,
            'SCRIPT_NAME' => $entryScript,
            'SERVER_NAME' => parse_url($entryUrl, PHP_URL_HOST),
            'SERVER_PORT' => parse_url($entryUrl, PHP_URL_PORT) ?: '80',
            'HTTPS' => parse_url($entryUrl, PHP_URL_SCHEME) === 'https'
        ]);
    }
587311
def build_network_settings(**settings):
    '''
    
    '''
    changes = []

    # Read current configuration and store default values
    current_network_settings = _parse_current_network_settings()

    # Build settings
    opts = _parse_network_settings(settings, current_network_settings)

    # Ubuntu has moved away from /etc/default/networking
    # beginning with the 12.04 release so we disable or enable
    # the networking related services on boot
    skip_etc_default_networking = (
        __grains__['osfullname'] == 'Ubuntu' and
        int(__grains__['osrelease'].split('.')[0]) >= 12)
    if skip_etc_default_networking:
        if opts['networking'] == 'yes':
            service_cmd = 'service.enable'
        else:
            service_cmd = 'service.disable'

        if __salt__['service.available']('NetworkManager'):
            __salt__[service_cmd]('NetworkManager')

        if __salt__['service.available']('networking'):
            __salt__[service_cmd]('networking')
    else:
        try:
            template = JINJA.get_template('network.jinja')
        except jinja2.exceptions.TemplateNotFound:
            log.error('Could not load template network.jinja')
            return ''
        network = template.render(opts)

        if 'test' in settings and settings['test']:
            return _read_temp(network)
        # Write settings
        _write_file_network(network, _DEB_NETWORKING_FILE, True)

    # Get hostname and domain from opts
    sline = opts['hostname'].split('.', 1)
    opts['hostname'] = sline[0]
    current_domainname = current_network_settings['domainname']
    current_searchdomain = current_network_settings['searchdomain']

    new_domain = False
    if len(sline) > 1:
        new_domainname = sline[1]
        if new_domainname != current_domainname:
            domainname = new_domainname
            opts['domainname'] = new_domainname
            new_domain = True
        else:
            domainname = current_domainname
            opts['domainname'] = domainname
    else:
        domainname = current_domainname
        opts['domainname'] = domainname

    new_search = False
    if 'search' in opts:
        new_searchdomain = opts['search']
        if new_searchdomain != current_searchdomain:
            searchdomain = new_searchdomain
            opts['searchdomain'] = new_searchdomain
            new_search = True
        else:
            searchdomain = current_searchdomain
            opts['searchdomain'] = searchdomain
    else:
        searchdomain = current_searchdomain
        opts['searchdomain'] = searchdomain

    # If the domain changes, then we should write the resolv.conf file.
    if new_domain or new_search:
        # Look for existing domain line and update if necessary
        resolve = _parse_resolve()
        domain_prog = re.compile(r'domain\s+')
        search_prog = re.compile(r'search\s+')
        new_contents = []

        for item in _read_file(_DEB_RESOLV_FILE):
            if domain_prog.match(item):
                item = 'domain {0}'.format(domainname)
            elif search_prog.match(item):
                item = 'search {0}'.format(searchdomain)
            new_contents.append(item)

        # A domain line didn't exist so we'll add one in
        # with the new domainname
        if 'domain' not in resolve:
            new_contents.insert(0, 'domain {0}' . format(domainname))

        # A search line didn't exist so we'll add one in
        # with the new search domain
        if 'search' not in resolve:
            new_contents.insert('domain' in resolve, 'search {0}'.format(searchdomain))

        new_resolv = '\n'.join(new_contents)

        # Write /etc/resolv.conf
        if not ('test' in settings and settings['test']):
            _write_file_network(new_resolv, _DEB_RESOLV_FILE)

    #  used for returning the results back
    try:
        template = JINJA.get_template('display-network.jinja')
    except jinja2.exceptions.TemplateNotFound:
        log.error('Could not load template display-network.jinja')
        return ''
    network = template.render(opts)
    changes.extend(_read_temp(network))

    return changes
541588
def init_app(module, BASE_DIR, **kwargs):
    
    global app

    def init_config():
        """
        Load settings module and attach values to the application
        config dictionary
        """
        if 'FLASK_PHILO_SETTINGS_MODULE' not in os.environ:
            raise ConfigurationError('No settings has been defined')

        app.config['BASE_DIR'] = BASE_DIR

        # default settings
        for v in dir(default_settings):
            if not v.startswith('_'):
                app.config[v] = getattr(default_settings, v)

        app.debug = app.config['DEBUG']

        # app settings
        settings = importlib.import_module(
            os.environ['FLASK_PHILO_SETTINGS_MODULE'])
        for v in dir(settings):
            if not v.startswith('_'):
                app.config[v] = getattr(settings, v)

        def init_urls():
            # Reads urls definition from URLs file and bind routes and views
            urls_module = importlib.import_module(app.config['URLS'])
            for route in urls_module.URLS:
                app.add_url_rule(
                    route[0], view_func=route[1].as_view(route[2]))

        def init_logging():
            """
            initialize logger for the app
            """

            hndlr = logging.StreamHandler()
            formatter = logging.Formatter(
                '%(asctime)s - %(name)s - %(levelname)s - %(message)s')
            hndlr.setFormatter(formatter)
            app.logger.addHandler(hndlr)
            log_level = app.config['LOG_LEVEL']
            app.logger.setLevel(getattr(logging, log_level))

        def init_flask_oauthlib():
            """
            http://flask-oauthlib.readthedocs.io/en/latest/oauth2.html
            """
            oauth.init_app(app)

        def init_cors(app):
            """
            Initializes cors protection if config
            """

            if 'CORS' in app.config:
                CORS(
                    app,
                    resources=app.config['CORS'],
                    supports_credentials=app.config.get(
                        "CORS_SUPPORT_CREDENTIALS",
                        False
                    ),
                    allow_headers=app.config.get(
                        "CORS_ALLOW_HEADERS",
                        "Content-Type,Authorization,accept-language,accept"
                    )
                )

        init_db(g, app)
        init_logging()
        init_urls()
        init_flask_oauthlib()
        init_jinja2(g, app)
        init_cors(app)
    app = Flask(module)
    init_config()
    return app
1093121
function Init(appGlobal, pathsList) {
            debug("Initializing Boot");
            loadFinder = new Finder();
            loadProvider = new Provider();
            loadNamespace = new Namespace();
            global = appGlobal;
            global.App = {};
            global.Modules = {};
            global.Config = {};
            this.initProviders(sortProvider);
            this.initApplication();
            this.initModules();
            var mainApp = require("../express");
            this.boot(mainApp);
            mainApp.boot = function (nameProvider, userApp) {
                debug("Booting Manual Provider");
                loadProvider.bootProvider(nameProvider, userApp ? userApp : mainApp);
            };
            mainApp.provider = function (nameProvider) {
                debug("Getting " + nameProvider + " Provider");
                return loadProvider.providerByName(nameProvider).instance;
            };
            return mainApp;
        }
1202123
def _setup(self):
        
        settings_module  = None
        #Get the settings module from the environment variables
        try:
            settings_module = os.environ[global_settings.MODULE_VARIABLE]
        except KeyError:
            error_message = "Settings not properly configured.  Cannot find the environment variable {0}".format(global_settings.MODULE_VARIABLE)
            log.exception(error_message)

        self._initialize(settings_module)
        self._configure_logging()
477042
def initialize_options(self):
        """"""
        # Each user option must be listed here with their default value.
        self.debug = False
        self.ignore_errors = False
        self.distros = ''
        self.conductor_provider = 'ansible'
911
def init():
    """"""
    global __dev, __cfg_descr
    devices = get_dfu_devices(idVendor=__VID, idProduct=__PID)
    if not devices:
        raise ValueError('No DFU device found')
    if len(devices) > 1:
        raise ValueError("Multiple DFU devices found")
    __dev = devices[0]
    __dev.set_configuration()

    # Claim DFU interface
    usb.util.claim_interface(__dev, __DFU_INTERFACE)

    # Find the DFU configuration descriptor, either in the device or interfaces
    __cfg_descr = None
    for cfg in __dev.configurations():
        __cfg_descr = find_dfu_cfg_descr(cfg.extra_descriptors)
        if __cfg_descr:
            break
        for itf in cfg.interfaces():
            __cfg_descr = find_dfu_cfg_descr(itf.extra_descriptors)
            if __cfg_descr:
                break

    # Get device into idle state
    for attempt in range(4):
        status = get_status()
        if status == __DFU_STATE_DFU_IDLE:
            break
        elif (status == __DFU_STATE_DFU_DOWNLOAD_IDLE
            or status == __DFU_STATE_DFU_UPLOAD_IDLE):
            abort_request()
        else:
            clr_status()
591554
def initialize(
        self, region="us-west-1", host=None, port=8000, config_dir=None, session=None
    ):
        
        try:
            import readline
            import rlcompleter
        except ImportError:
            # Windows doesn't have readline, so gracefully ignore.
            pass
        else:
            # Mac OS X readline compatibility from http://stackoverflow.com/a/7116997
            if "libedit" in readline.__doc__:
                readline.parse_and_bind("bind ^I rl_complete")
            else:
                readline.parse_and_bind("tab: complete")
            # Tab-complete names with a '-' in them
            delims = set(readline.get_completer_delims())
            if "-" in delims:
                delims.remove("-")
                readline.set_completer_delims("".join(delims))

        self._conf_dir = config_dir or os.path.join(
            os.environ.get("HOME", "."), ".config"
        )
        self.session = session or botocore.session.get_session()
        self.engine = FragmentEngine()
        self.engine.caution_callback = self.caution_callback
        if host is not None:
            self._local_endpoint = (host, port)
        self.engine.connect(
            region, session=self.session, host=host, port=port, is_secure=(host is None)
        )

        self.conf = self.load_config()
        for key, value in iteritems(DEFAULT_CONFIG):
            self.conf.setdefault(key, value)
        self.display = DISPLAYS[self.conf["display"]]
        self.throttle = TableLimits()
        self.throttle.load(self.conf["_throttle"])
1105439
function(config) {
			if (initialized) {
				error(new Error('Cannot set global configuration after application initialization'));
				return;
			}

			for (var prop in config) {
				if (config.hasOwnProperty(prop)) {
					globalConfig[prop] = config[prop];
				}
			}
		}
1047769
def initialise():
    
    global settings, project_settings

    # Global changes settings
    settings = Changes.load()

    # Project specific settings
    project_settings = Project.load(GitHubRepository(auth_token=settings.auth_token))