@rest_initialiser(enterprise_check=False)
def execute(self, opts):
    (initialized, errors) = self.rest.is_cluster_initialized()
    _exit_if_errors(errors)
    if initialized:
        _exit_if_errors(['Cluster is already initialized, use setting-cluster to change settings'])
    if ((not self.enterprise) and (opts.index_storage_mode == 'memopt')):
        _exit_if_errors(['memopt option for --index-storage-setting can only be configured on enterprise edition'])
    (services, errors) = process_services(opts.services, self.enterprise)
    _exit_if_errors(errors)
    if ('kv' not in services.split(',')):
        _exit_if_errors(['Cannot set up first cluster node without the data service'])
    if (opts.data_mem_quota or opts.index_mem_quota or opts.fts_mem_quota or opts.cbas_mem_quota or opts.eventing_mem_quota or (opts.name is not None)):
        (_, errors) = self.rest.set_pools_default(opts.data_mem_quota, opts.index_mem_quota, opts.fts_mem_quota, opts.cbas_mem_quota, opts.eventing_mem_quota, opts.name)
    _exit_if_errors(errors)
    if ((not opts.index_storage_mode) and ('index' in services.split(','))):
        opts.index_storage_mode = 'default'
    default = 'plasma'
    if (not self.enterprise):
        default = 'forestdb'
    if opts.index_storage_mode:
        param = index_storage_mode_to_param(opts.index_storage_mode, default)
        (_, errors) = self.rest.set_index_settings(param, None, None, None, None, None, None, None)
        _exit_if_errors(errors)
    (_, errors) = self.rest.setup_services(services)
    _exit_if_errors(errors)
    if (opts.notifications == '1'):
        (_, errors) = self.rest.enable_notifications(True)
    else:
        (_, errors) = self.rest.enable_notifications(False)
    _exit_if_errors(errors)
    (_, errors) = self.rest.set_admin_credentials(opts.username, opts.password, opts.port)
    _exit_if_errors(errors)
    _success('Cluster initialized')
@rest_initialiser(enterprise_check=False)
def execute(self, opts):
    (initialized, errors) = self.rest.is_cluster_initialized()
    _exit_if_errors(errors)
    if initialized:
        _exit_if_errors(['Cluster is already initialized, use setting-cluster to change settings'])
    if ((not self.enterprise) and (opts.index_storage_mode == 'memopt')):
        _exit_if_errors(['memopt option for --index-storage-setting can only be configured on enterprise edition'])
    (services, errors) = process_services(opts.services, self.enterprise)
    _exit_if_errors(errors)
    if ('kv' not in services.split(',')):
        _exit_if_errors(['Cannot set up first cluster node without the data service'])
    if (opts.data_mem_quota or opts.index_mem_quota or opts.fts_mem_quota or opts.cbas_mem_quota or opts.eventing_mem_quota or (opts.name is not None)):
        (_, errors) = self.rest.set_pools_default(opts.data_mem_quota, opts.index_mem_quota, opts.fts_mem_quota, opts.cbas_mem_quota, opts.eventing_mem_quota, opts.name)
    _exit_if_errors(errors)
    if ((not opts.index_storage_mode) and ('index' in services.split(','))):
        opts.index_storage_mode = 'default'
    default = 'plasma'
    if (not self.enterprise):
        default = 'forestdb'
    if opts.index_storage_mode:
        param = index_storage_mode_to_param(opts.index_storage_mode, default)
        (_, errors) = self.rest.set_index_settings(param, None, None, None, None, None, None, None)
        _exit_if_errors(errors)
    (_, errors) = self.rest.setup_services(services)
    _exit_if_errors(errors)
    if (opts.notifications == '1'):
        (_, errors) = self.rest.enable_notifications(True)
    else:
        (_, errors) = self.rest.enable_notifications(False)
    _exit_if_errors(errors)
    (_, errors) = self.rest.set_admin_credentials(opts.username, opts.password, opts.port)
    _exit_if_errors(errors)
    _success('Cluster initialized')