id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
24,700 | zpool_cachefile.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/zpool_cachefile.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
from pathlib import Path
from middlewared.service import Service
from middlewared.schema import Str, accepts
from middlewared.plugins.pool_.utils import... | 2,322 | Python | .py | 48 | 37.875 | 83 | 0.632833 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,701 | configure.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/configure.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
from middlewared.service import Service
HA_LICENSE_CACHE_KEY = 'LICENSED_FOR_HA'
class FailoverConfigureService(Service):
class Config:
n... | 2,697 | Python | .py | 50 | 41.54 | 119 | 0.627228 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,702 | event_exceptions.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/event_exceptions.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
class AllZpoolsFailedToImport(Exception):
"""
This is raised if all zpools failed to
import when becoming master.
"""
pass
class Ig... | 528 | Python | .py | 20 | 22.55 | 70 | 0.715706 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,703 | status.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/status.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
from middlewared.service import Service
class DetectFailoverStatusService(Service):
class Config:
private = True
namespace = 'fail... | 3,940 | Python | .py | 72 | 42.819444 | 97 | 0.612594 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,704 | ha_hardware.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/ha_hardware.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import enum
import re
class HA_HARDWARE(enum.Enum):
"""
The echostream E16 JBOD and the echostream Z-series chassis
are the same piece of h... | 1,247 | Python | .py | 23 | 50.173913 | 83 | 0.722496 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,705 | nftables.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/nftables.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
from subprocess import run, PIPE, STDOUT
from middlewared.service import Service, accepts, job, CallError
FW_RULES_FILE = '/tmp/fw-rules.nft'
JOB_LOCK... | 4,585 | Python | .py | 90 | 39.744444 | 108 | 0.59222 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,706 | scheduled_reboot_alert.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/scheduled_reboot_alert.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import datetime
import os
WATCHDOG_ALERT_FILE = "/data/sentinels/.watchdog-alert"
FENCED_ALERT_FILE = "/data/sentinels/.fenced-alert"
def get_fqdn(mid... | 2,308 | Python | .py | 49 | 38.959184 | 113 | 0.657016 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,707 | disabled_reasons.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/disabled_reasons.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
from enum import Enum
from middlewared.schema import accepts, returns, List, Str
from middlewared.service import Service, CallError, pass_app, no_auth_re... | 10,314 | Python | .py | 175 | 48.588571 | 106 | 0.674057 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,708 | internal_interface.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/internal_interface.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import ipaddress
from pathlib import Path
from pyroute2 import NDB
from middlewared.service import Service
from middlewared.utils.functools_ import cac... | 4,262 | Python | .py | 91 | 36.637363 | 100 | 0.626506 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,709 | datastore.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/datastore.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import os
import time
from middlewared.service import Service
from middlewared.plugins.config import FREENAS_DATABASE
from middlewared.plugins.datastore... | 8,075 | Python | .py | 146 | 44.383562 | 151 | 0.649823 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,710 | jobs_copy.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/jobs_copy.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import base64
import gzip
import os
from middlewared.service import CompoundService, Service
from middlewared.utils.service.task_state import TaskStateM... | 2,799 | Python | .py | 61 | 36.622951 | 119 | 0.635394 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,711 | fenced.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/fenced.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import subprocess
import psutil
import contextlib
import os
import signal
from middlewared.plugins.system.product import ProductType
from middlewared.se... | 5,211 | Python | .py | 124 | 32.080645 | 107 | 0.602134 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,712 | remote.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/remote.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import errno
import json
import logging
import requests
import socket
import threading
import time
from collections import defaultdict
from functools imp... | 13,016 | Python | .py | 301 | 32.093023 | 112 | 0.595484 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,713 | reboot.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/reboot.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
import asyncio
from dataclasses import asdict, dataclass
import errno
import time
from middlewared.api import api_method
from middlewared.api.current imp... | 7,944 | Python | .py | 154 | 41.467532 | 120 | 0.650323 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,714 | vrrp.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/vrrp.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
from middlewared.service import Service
MASTER_PRIO = 254
BACKUP_PRIO = 200
class FailoverVrrpService(Service):
class Config:
private = Tr... | 1,089 | Python | .py | 27 | 33 | 70 | 0.65782 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,715 | virtual_ips.py | truenas_middleware/src/middlewared/middlewared/plugins/failover_/virtual_ips.py | # Copyright (c) - iXsystems Inc.
#
# Licensed under the terms of the TrueNAS Enterprise License Agreement
# See the file LICENSE.IX for complete terms and conditions
from middlewared.service import Service
class DetectVirtualIpStates(Service):
class Config:
private = True
namespace = 'failover.v... | 4,335 | Python | .py | 81 | 40.802469 | 105 | 0.588388 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,716 | chflags.py | truenas_middleware/src/middlewared/middlewared/plugins/filesystem_/chflags.py | import fcntl
import os
import struct
from middlewared.service import CallError
F_IOC_GETFLAGS = 0x80086601
F_IOC_SETFLAGS = 0x40086602
IMMUTABLE_FL = 16
def is_immutable_set(path: str) -> bool:
flags = get_flags(path)
return bool(flags & IMMUTABLE_FL)
def get_flags(path: str) -> int:
fd = os.open(pat... | 1,257 | Python | .py | 33 | 33.424242 | 97 | 0.673823 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,717 | perm_check.py | truenas_middleware/src/middlewared/middlewared/plugins/filesystem_/perm_check.py | import errno
import os
import pathlib
from middlewared.schema import accepts, Bool, Dict, returns, Str
from middlewared.service import CallError, Service, private
from middlewared.utils.nss import pwd, grp
from middlewared.utils.user_context import run_with_user_context, set_user_context
# This should be a sufficien... | 9,323 | Python | .py | 213 | 32.483568 | 118 | 0.550469 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,718 | acl_template.py | truenas_middleware/src/middlewared/middlewared/plugins/filesystem_/acl_template.py | from middlewared.service import CallError, CRUDService, ValidationErrors
from middlewared.service import accepts, private, returns
from middlewared.schema import Bool, Dict, Int, List, Str, Ref, Patch, OROperator
from middlewared.plugins.smb import SMBBuiltin
from middlewared.utils.directoryservices.constants import DS... | 12,524 | Python | .py | 284 | 32.873239 | 134 | 0.555938 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,719 | utils.py | truenas_middleware/src/middlewared/middlewared/plugins/filesystem_/utils.py | import enum
class ACLType(enum.Enum):
NFS4 = (['tag', 'id', 'perms', 'flags', 'type'], ["owner@", "group@", "everyone@"])
POSIX1E = (['default', 'tag', 'id', 'perms'], ["USER_OBJ", "GROUP_OBJ", "OTHER", "MASK"])
DISABLED = ([], [])
def _validate_id(self, id_, special):
if id_ is None or id_ <... | 6,018 | Python | .py | 138 | 30.724638 | 111 | 0.529945 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,720 | acl.py | truenas_middleware/src/middlewared/middlewared/plugins/filesystem_/acl.py | import errno
import json
import os
import subprocess
import stat as pystat
from pathlib import Path
from middlewared.schema import Bool, Dict, Int, List, Str, Ref, UnixPerm, OROperator
from middlewared.service import accepts, private, returns, job, CallError, ValidationErrors, Service
from middlewared.utils.filesystem... | 39,103 | Python | .py | 913 | 29.514786 | 120 | 0.517948 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,721 | passdb.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/passdb.py | import os
from middlewared.api.current import UserEntry
from middlewared.service import filterable, Service, job, private
from middlewared.utils.sid import get_domain_rid
from .util_passdb import (
delete_passdb_entry,
insert_passdb_entries,
query_passdb_entries,
update_passdb_entry,
user_entry_to_... | 3,376 | Python | .py | 73 | 37.273973 | 105 | 0.645053 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,722 | util_smbconf.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/util_smbconf.py | import os
from logging import getLogger
from middlewared.utils import filter_list
from middlewared.utils.directoryservices.constants import DSType
from middlewared.plugins.account import DEFAULT_HOME_PATH
from middlewared.plugins.smb_.constants import LOGLEVEL_MAP, SMBEncryption, SMBPath
LOGGER = getLogger(__name__)
... | 12,577 | Python | .py | 275 | 36.967273 | 98 | 0.62551 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,723 | util_net_conf.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/util_net_conf.py | import errno
import json
import subprocess
from middlewared.service_exception import CallError, MatchNotFound
from .constants import SMBCmd
CONF_JSON_VERSION = {"major": 0, "minor": 1}
NETCONF_ACTIONS = (
'list',
'showshare',
'addshare',
'delshare',
'getparm',
'setparm',
'delparm',
)
def... | 4,550 | Python | .py | 133 | 28.097744 | 85 | 0.646333 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,724 | sharesec.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/sharesec.py | import os
from base64 import b64encode, b64decode
from middlewared.plugins.sysdataset import SYSDATASET_PATH
from middlewared.service import filterable, periodic, private, CRUDService
from middlewared.service_exception import CallError, MatchNotFound
from middlewared.utils import filter_list
from middlewared.utils.sec... | 7,641 | Python | .py | 156 | 39.628205 | 109 | 0.624362 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,725 | util_sd.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/util_sd.py | import errno
import enum
import json
import subprocess
from middlewared.schema import Bool, Dict, Password, Str, accepts
from middlewared.service import private, CallError, Service
from middlewared.plugins.smb import SMBCmd
class ACLType(enum.Enum):
SMB = "SMB"
NFSV4 = "NFSV4"
class ACLPrincipal(enum.Enum)... | 11,952 | Python | .py | 279 | 31.21147 | 129 | 0.521949 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,726 | constants.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/constants.py | import enum
from bidict import bidict
from middlewared.utils import MIDDLEWARE_RUN_DIR
NETIF_COMPLETE_SENTINEL = f"{MIDDLEWARE_RUN_DIR}/ix-netif-complete"
CONFIGURED_SENTINEL = '/var/run/samba/.configured'
SMB_AUDIT_DEFAULTS = {'enable': False, 'watch_list': [], 'ignore_list': []}
INVALID_SHARE_NAME_CHARACTERS = {'%'... | 4,846 | Python | .py | 136 | 29.294118 | 113 | 0.592442 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,727 | util_passdb.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/util_passdb.py | # Utilities that wrap around samba's passdb.tdb file
#
# test coverage provided by src/middlewared/middlewared/pytest/unit/utils/test_passdb.py
# sample tdb contents (via tdbdump)
#
# {
# key(19) = "INFO/minor_version\00"
# data(4) = "\00\00\00\00"
# }
# {
# key(13) = "RID_00004e66\00"
# data(8) = "smbuser\00"
# }
# {
... | 18,939 | Python | .py | 444 | 35.851351 | 544 | 0.664184 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,728 | registry_share.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/registry_share.py | from middlewared.service import private, Service
from middlewared.service_exception import CallError
from middlewared.plugins.smb import SMBCmd, SMBHAMODE
from middlewared.plugins.smb_.smbconf.reg_service import ShareSchema
from .utils import smb_strip_comments
from .util_net_conf import (
reg_setparm,
... | 4,695 | Python | .py | 116 | 30.974138 | 104 | 0.58958 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,729 | disable_acl_if_trivial.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/disable_acl_if_trivial.py | import contextlib
import os
import textwrap
from middlewared.service import private, Service
class SMBService(Service):
class Config:
service = 'cifs'
service_verb = 'restart'
@private
async def disable_acl_if_trivial(self):
share_ids = await self.middleware.call("keyvalue.get", ... | 1,743 | Python | .py | 36 | 35.416667 | 119 | 0.572438 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,730 | util_groupmap.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/util_groupmap.py | # Utilities that wrap around samba's group_mapping.tdb file
#
# test coverage provided by src/middlewared/middlewared/pytest/unit/utils/test_groupmap.py
# sample tdb contents (via tdbdump)
#
# {
# key(23) = "UNIXGROUP/S-1-5-32-546\00"
# data(16) = "\83J]\05\04\00\00\00Guests\00\00"
# }
# {
# key(58) = "UNIXGROUP/S-1-5-... | 9,231 | Python | .py | 228 | 35.451754 | 100 | 0.68984 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,731 | sid.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/sid.py | import subprocess
from middlewared.service import Service, private
from middlewared.service_exception import CallError
from middlewared.utils.functools_ import cache
from middlewared.utils.sid import random_sid
from .constants import SMBCmd
class SMBService(Service):
class Config:
service = 'cifs'
... | 1,021 | Python | .py | 27 | 30.851852 | 96 | 0.661929 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,732 | status.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/status.py | from middlewared.schema import Bool, Dict, Ref, Str
from middlewared.service import Service, accepts
from middlewared.plugins.smb import SMBCmd
from middlewared.service_exception import CallError
from middlewared.utils import filter_list
import enum
import json
import subprocess
import time
class InfoLevel(enum.Enum... | 5,031 | Python | .py | 110 | 35.881818 | 98 | 0.602944 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,733 | utils.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/utils.py | from .constants import SMBSharePreset
from secrets import randbits
def random_sid():
""" See MS-DTYP 2.4.2 SID """
subauth_1 = randbits(32)
subauth_2 = randbits(32)
subauth_3 = randbits(32)
return f'S-1-5-21-{subauth_1}-{subauth_2}-{subauth_3}'
def smb_strip_comments(auxparam_in):
"""
S... | 2,794 | Python | .py | 65 | 35.415385 | 145 | 0.6369 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,734 | groupmap.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/groupmap.py | import os
import tdb
import struct
from middlewared.service import Service, job, private
from middlewared.service_exception import CallError
from middlewared.utils.directoryservices.constants import DSStatus, DSType
from middlewared.utils.sid import (
db_id_to_rid,
get_domain_rid,
lsa_sidtype,
sid_is_v... | 22,273 | Python | .py | 462 | 35.623377 | 109 | 0.58122 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,735 | registry_base.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/registry_base.py | class RegObj():
def __init__(self, name, smbconf, default, **kwargs):
self.name = name
self.smbconf = smbconf
self.default = default
self.smbconf_parser = kwargs.get("smbconf_parser", None)
self.schema_parser = kwargs.get("schema_parser", None)
self.middleware = kwarg... | 1,721 | Python | .py | 43 | 29.953488 | 68 | 0.573141 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,736 | util_param.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/util_param.py | import os
import threading
from middlewared.service_exception import CallError, MatchNotFound
try:
from samba.samba3 import param as s3param
except ImportError:
s3param = None
try:
from samba import param
except ImportError:
param = None
from .constants import SMBPath
from .util_net_conf import reg_... | 1,465 | Python | .py | 41 | 31.04878 | 96 | 0.728886 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,737 | attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/attachments.py | from middlewared.common.ports import ServicePortDelegate
class SMBServicePortDelegate(ServicePortDelegate):
name = 'smb'
namespace = 'smb'
title = 'SMB Service'
async def get_ports_bound_on_wildcards(self):
return [137, 138, 139, 445]
async def setup(middleware):
await middleware.call(... | 393 | Python | .py | 9 | 38.888889 | 98 | 0.76455 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,738 | reg_service.py | truenas_middleware/src/middlewared/middlewared/plugins/smb_/smbconf/reg_service.py | from middlewared.plugins.smb_.registry_base import RegObj, RegistrySchema
from middlewared.plugins.smb_.utils import apply_presets
from middlewared.utils.path import FSLocation, path_location, strip_location_prefix
from middlewared.utils.directoryservices.constants import DSType
FRUIT_CATIA_MAPS = [
"0x01:0xf001,... | 16,768 | Python | .py | 376 | 33.470745 | 119 | 0.565969 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,739 | network.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/network.py | from middlewared.plugins.apps.ix_apps.docker.networks import list_networks
from middlewared.schema import Dict, Str
from middlewared.service import CRUDService, filterable, private
from middlewared.utils import filter_list
class DockerNetworkService(CRUDService):
class Config:
namespace = 'docker.network... | 1,850 | Python | .py | 45 | 32.2 | 93 | 0.616027 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,740 | validation_utils.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/validation_utils.py | import ipaddress
from middlewared.schema import ValidationErrors
def validate_address_pools(system_ips: list[dict], user_specified_networks: list[dict]):
verrors = ValidationErrors()
if not user_specified_networks:
verrors.add('docker_update.address_pools', 'At least one address pool must be specifie... | 1,684 | Python | .py | 35 | 38.171429 | 98 | 0.640854 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,741 | utils.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/utils.py | import os
def applications_ds_name(pool: str) -> str:
return os.path.join(pool, 'ix-apps')
| 97 | Python | .py | 3 | 29.333333 | 43 | 0.706522 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,742 | events.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/events.py | from middlewared.plugins.apps.ix_apps.docker.utils import get_docker_client, PROJECT_KEY
from middlewared.service import Service
class DockerEventService(Service):
class Config:
namespace = 'docker.events'
private = True
def setup(self):
if not self.middleware.call_sync('docker.state... | 1,719 | Python | .py | 37 | 35.675676 | 104 | 0.606459 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,743 | state_management.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/state_management.py | from middlewared.service import CallError, periodic, Service, private
from .state_utils import APPS_STATUS, Status, STATUS_DESCRIPTIONS
class DockerStateService(Service):
class Config:
namespace = 'docker.state'
private = True
STATUS = APPS_STATUS(Status.PENDING, STATUS_DESCRIPTIONS[Status.... | 5,547 | Python | .py | 108 | 41.472222 | 109 | 0.658843 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,744 | state_setup.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/state_setup.py | import contextlib
import os
import shutil
import uuid
from datetime import datetime
from middlewared.service import CallError, private, Service
from middlewared.utils.interface import wait_for_default_interface_link_state_up
from .state_utils import (
DatasetDefaults, DOCKER_DATASET_NAME, docker_datasets, IX_APP... | 6,161 | Python | .py | 119 | 40.042017 | 112 | 0.613519 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,745 | fs_manage.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/fs_manage.py | import errno
from middlewared.service import CallError, Service
from .state_utils import IX_APPS_MOUNT_PATH, Status
class DockerFilesystemManageService(Service):
class Config:
namespace = 'docker.fs_manage'
private = True
async def common_func(self, mount):
if docker_ds := (await s... | 1,723 | Python | .py | 40 | 31.775 | 120 | 0.589467 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,746 | state_utils.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/state_utils.py | import dataclasses
import collections
import enum
import os
import typing
APPS_STATUS: collections.namedtuple = collections.namedtuple('Status', ['status', 'description'])
CATALOG_DATASET_NAME: str = 'truenas_catalog'
DOCKER_DATASET_NAME: str = 'ix-apps'
IX_APPS_DIR_NAME = '.ix-apps'
IX_APPS_MOUNT_PATH: str = os.path... | 3,812 | Python | .py | 96 | 33.677083 | 105 | 0.658814 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,747 | attachments.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/attachments.py | import os
from middlewared.common.attachment import FSAttachmentDelegate
class DockerFSAttachmentDelegate(FSAttachmentDelegate):
name = 'docker'
title = 'Docker'
service = 'docker'
async def query(self, path, enabled, options=None):
results = []
k8s_config = await self.middleware.ca... | 1,751 | Python | .py | 40 | 35.225 | 110 | 0.65822 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,748 | update.py | truenas_middleware/src/middlewared/middlewared/plugins/docker/update.py | import errno
import middlewared.sqlalchemy as sa
from middlewared.schema import accepts, Bool, Dict, Int, IPAddr, List, Patch, Str, ValidationErrors
from middlewared.service import CallError, ConfigService, job, private, returns
from middlewared.utils.zfs import query_imported_fast_impl
from middlewared.validators im... | 6,621 | Python | .py | 137 | 36.233577 | 118 | 0.5803 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,749 | firstboot.py | truenas_middleware/src/middlewared/middlewared/plugins/usage_/firstboot.py | from middlewared.service import Service
class UsageService(Service):
FAILED_RETRIES = 3
class Config:
private = True
async def firstboot(self):
_hash = await self.middleware.call('system.host_id')
version = await self.middleware.call('system.version')
retries = self.FAIL... | 824 | Python | .py | 22 | 24.954545 | 83 | 0.537014 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,750 | update.py | truenas_middleware/src/middlewared/middlewared/plugins/security/update.py | import middlewared.sqlalchemy as sa
from middlewared.plugins.failover_.disabled_reasons import DisabledReasonsEnum
from middlewared.plugins.system.reboot import RebootReason
from middlewared.schema import accepts, Bool, Dict, Int, Patch
from middlewared.service import ConfigService, ValidationError, job, private
cla... | 4,452 | Python | .py | 90 | 38.622222 | 119 | 0.631361 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,751 | info.py | truenas_middleware/src/middlewared/middlewared/plugins/security/info.py | from subprocess import run
from middlewared.schema import accepts, returns, Bool
from middlewared.service import CallError, Service
class SystemSecurityInfoService(Service):
class Config:
namespace = 'system.security.info'
cli_namespace = 'system.security.info'
@accepts(roles=['READONLY_ADM... | 1,145 | Python | .py | 24 | 40.75 | 92 | 0.693896 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,752 | pool_wait.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/pool_wait.py | import libzfs
from middlewared.schema import accepts, Dict, Str
from middlewared.service import CallError, Service
POOL_ACTIVITY_TYPES = [a.name for a in libzfs.ZpoolWaitActivity]
class ZFSPoolService(Service):
class Config:
namespace = 'zfs.pool'
private = True
process_pool = True
... | 748 | Python | .py | 23 | 24.26087 | 74 | 0.614206 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,753 | pool_status.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/pool_status.py | from pathlib import Path
from middlewared.schema import accepts, Bool, Dict, Str
from middlewared.service import Service
from .status_util import get_normalized_disk_info, get_zfs_vdev_disks, get_zpool_status
class ZPoolService(Service):
class Config:
namespace = 'zpool'
private = True
... | 5,975 | Python | .py | 122 | 33.983607 | 119 | 0.482859 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,754 | status_util.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/status_util.py | import json
import subprocess
from middlewared.service import CallError, ValidationError
def get_normalized_disk_info(pool_name: str, disk: dict, vdev_name: str, vdev_type: str, vdev_disks: list) -> dict:
return {
'pool_name': pool_name,
'disk_status': disk['state'],
'disk_read_errors': d... | 1,507 | Python | .py | 36 | 35.027778 | 115 | 0.617385 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,755 | dataset_quota.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/dataset_quota.py | import libzfs
from middlewared.plugins.zfs_.utils import TNUserProp
from middlewared.service import CallError, Service
class ZFSDatasetService(Service):
class Config:
namespace = 'zfs.dataset'
private = True
process_pool = True
def query_for_quota_alert(self):
options = {
... | 5,846 | Python | .py | 132 | 30.469697 | 117 | 0.536128 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,756 | pool.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/pool.py | import errno
import libzfs
from middlewared.schema import accepts, Bool, Dict, Int, List, Str
from middlewared.service import CallError, CRUDService, filterable, job, ValidationErrors
from middlewared.utils import filter_list
from middlewared.utils.zfs import guid_fast_impl, state_fast_impl, query_imported_fast_impl
f... | 6,112 | Python | .py | 153 | 27.751634 | 107 | 0.530313 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,757 | validation_utils.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/validation_utils.py | import libzfs
from .utils import zvol_name_to_path
def check_zvol_in_boot_pool_using_name(zvol_name: str) -> bool:
return check_zvol_in_boot_pool_using_path(zvol_name_to_path(zvol_name))
def check_zvol_in_boot_pool_using_path(zvol_path: str) -> bool:
from middlewared.plugins.boot import BOOT_POOL_NAME
... | 658 | Python | .py | 13 | 46.923077 | 75 | 0.752366 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,758 | zfs_events.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/zfs_events.py | import threading
import libzfs
from middlewared.alert.base import (
Alert, AlertCategory, AlertClass, AlertLevel, OneShotAlertClass, SimpleOneShotAlertClass
)
from middlewared.plugins.boot import BOOT_POOL_NAME
from middlewared.utils.threading import start_daemon_thread
CACHE_POOLS_STATUSES = 'system.system_heal... | 8,798 | Python | .py | 178 | 40.320225 | 120 | 0.649364 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,759 | dataset_encryption.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/dataset_encryption.py | import libzfs
from middlewared.schema import accepts, Any, Bool, Dict, Int, List, Ref, Str
from middlewared.service import CallError, job, Service
from middlewared.utils import filter_list
from .dataset_utils import flatten_datasets
from .utils import unlocked_zvols_fast, zvol_path_to_name
class ZFSDatasetService(S... | 8,907 | Python | .py | 216 | 29.680556 | 119 | 0.538382 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,760 | utils.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/utils.py | # -*- coding=utf-8 -*-
import enum
import logging
import os
import re
from middlewared.service_exception import MatchNotFound
from middlewared.utils.filesystem.constants import ZFSCTL
from middlewared.plugins.audit.utils import (
AUDIT_DEFAULT_FILL_CRITICAL, AUDIT_DEFAULT_FILL_WARNING
)
from middlewared.utils.tdb ... | 10,001 | Python | .py | 244 | 30.606557 | 111 | 0.586392 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,761 | dataset_actions.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/dataset_actions.py | import errno
import libzfs
import os
from middlewared.schema import accepts, Bool, Dict, Str
from middlewared.service import CallError, Service
from middlewared.utils.mount import getmntinfo
from middlewared.utils.path import is_child
def handle_ds_not_found(error_code: int, ds_name: str):
if error_code == libzf... | 5,066 | Python | .py | 120 | 31.475 | 99 | 0.593503 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,762 | snapshot.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/snapshot.py | import copy
import errno
import libzfs
from middlewared.schema import accepts, Bool, Dict, List, Str
from middlewared.service import CallError, CRUDService, filterable, private, ValidationErrors
from middlewared.service_exception import InstanceNotFound
from middlewared.utils import filter_list, filter_getattrs
from m... | 11,738 | Python | .py | 248 | 34.778226 | 118 | 0.570293 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,763 | pool_actions.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/pool_actions.py | import errno
import libzfs
import subprocess
import functools
from middlewared.schema import accepts, Bool, Dict, Str
from middlewared.service import CallError, Service
from .pool_utils import find_vdev, SEARCH_PATHS
class ZFSPoolService(Service):
class Config:
namespace = 'zfs.pool'
private = ... | 9,791 | Python | .py | 235 | 29.659574 | 119 | 0.547049 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,764 | events.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/events.py | import libzfs
import multiprocessing
import time
from middlewared.utils.threading import set_thread_name, start_daemon_thread
def zfs_events(child_conn):
with libzfs.ZFS() as zfs:
for event in zfs.zpool_events(blocking=True, skip_existing_events=True):
child_conn.send(event)
def setup_zfs_e... | 1,366 | Python | .py | 32 | 33.28125 | 102 | 0.644528 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,765 | pool_utils.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/pool_utils.py | import libzfs
from collections import defaultdict
SEARCH_PATHS = ['/dev/disk/by-partuuid', '/dev']
def convert_topology(zfs, vdevs):
topology = defaultdict(list)
for vdev in vdevs:
children = []
for device in vdev['devices']:
z_cvdev = libzfs.ZFSVdev(zfs, 'disk')
z_c... | 1,817 | Python | .py | 51 | 24.196078 | 71 | 0.510262 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,766 | dataset.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/dataset.py | import errno
import libzfs
import subprocess
from middlewared.schema import accepts, Bool, Dict, Str
from middlewared.service import CallError, CRUDService, filterable, ValidationErrors
from middlewared.utils import filter_list
from .dataset_utils import flatten_datasets
from .utils import get_snapshot_count_cached
... | 10,114 | Python | .py | 212 | 36.103774 | 119 | 0.600547 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,767 | exceptions.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/exceptions.py | from middlewared.service import CallError
class ZFSSetPropertyError(CallError):
def __init__(self, property_, error):
self.property = property_
self.error = error
super().__init__(f'Failed to update dataset: failed to set property {self.property}: {self.error}')
| 293 | Python | .py | 6 | 42.833333 | 107 | 0.698246 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,768 | snapshot_actions.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/snapshot_actions.py | import libzfs
import subprocess
from middlewared.schema import accepts, Bool, Dict, returns, Str
from middlewared.service import CallError, private, Service
class ZFSSnapshot(Service):
class Config:
namespace = 'zfs.snapshot'
process_pool = True
@accepts(Dict(
'snapshot_clone',
... | 4,784 | Python | .py | 126 | 27.579365 | 120 | 0.561165 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,769 | dataset_utils.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/dataset_utils.py | from copy import deepcopy
def flatten_datasets(datasets):
return sum([[deepcopy(ds)] + flatten_datasets(ds.get('children') or []) for ds in datasets], [])
| 161 | Python | .py | 3 | 50.666667 | 100 | 0.717949 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,770 | disks.py | truenas_middleware/src/middlewared/middlewared/plugins/zfs_/disks.py | import pyudev
from middlewared.service import Service
class ZFSPoolService(Service):
class Config:
namespace = 'zfs.pool'
private = True
process_pool = True
def get_disks(self, name):
sys_devices = {}
for dev in pyudev.Context().list_devices(subsystem='block'):
... | 1,538 | Python | .py | 33 | 34.848485 | 95 | 0.578983 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,771 | general.py | truenas_middleware/src/middlewared/middlewared/plugins/network_/general.py | from collections import defaultdict
from middlewared.service import Service
from middlewared.schema import Dict, List, IPAddr, returns, accepts
class NetworkGeneralService(Service):
class Config:
namespace = 'network.general'
cli_namespace = 'network.general'
@accepts(roles=['NETWORK_GENERA... | 2,390 | Python | .py | 62 | 25.629032 | 111 | 0.502374 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,772 | activity.py | truenas_middleware/src/middlewared/middlewared/plugins/network_/activity.py | # -*- coding=utf-8 -*-
import logging
from middlewared.schema import List, returns, Str
from middlewared.service import accepts, CallError, private, Service
logger = logging.getLogger(__name__)
class NetworkConfigurationService(Service):
class Config:
namespace = 'network.configuration'
@accepts()
... | 1,777 | Python | .py | 40 | 37.375 | 96 | 0.683111 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,773 | route.py | truenas_middleware/src/middlewared/middlewared/plugins/network_/route.py | import re
import ipaddress
import os
import contextlib
import signal
import asyncio
from pyroute2.netlink.exceptions import NetlinkError
from middlewared.service import Service, filterable, filterable_returns, private
from middlewared.schema import Dict, List, Str, Int, IPAddr, accepts, returns, Bool
from middlewared.... | 9,999 | Python | .py | 197 | 37.736041 | 115 | 0.592043 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,774 | common.py | truenas_middleware/src/middlewared/middlewared/plugins/network_/common.py | from middlewared.service import Service
class NetworkCommonService(Service):
class Config:
namespace = 'network.common'
private = True
async def check_failover_disabled(self, schema, verrors):
if not await self.middleware.call('failover.licensed'):
return
elif awa... | 905 | Python | .py | 18 | 41 | 115 | 0.651927 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,775 | global_config.py | truenas_middleware/src/middlewared/middlewared/plugins/network_/global_config.py | import ipaddress
import middlewared.sqlalchemy as sa
from middlewared.service import ConfigService, private
from middlewared.schema import accepts, Patch, List, Dict, Int, Str, Bool, IPAddr, Ref, URI, ValidationErrors
from middlewared.utils.directoryservices.constants import DSType
from middlewared.validators import M... | 17,214 | Python | .py | 342 | 38.511696 | 119 | 0.595027 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,776 | static_routes.py | truenas_middleware/src/middlewared/middlewared/plugins/network_/static_routes.py | from ipaddress import ip_interface
from middlewared.api import api_method
from middlewared.api.current import (
StaticRouteEntry,
StaticRouteUpdateArgs,
StaticRouteUpdateResult,
StaticRouteCreateArgs,
StaticRouteCreateResult,
StaticRouteDeleteArgs,
StaticRouteDeleteResult,
)
import middlewa... | 4,501 | Python | .py | 107 | 32.869159 | 99 | 0.639963 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,777 | dns.py | truenas_middleware/src/middlewared/middlewared/plugins/network_/dns.py | import contextlib
import ipaddress
import re
import subprocess
import tempfile
from middlewared.service import Service, filterable, filterable_returns, private
from middlewared.schema import accepts, Bool, Dict, Int, IPAddr, List, Str, ValidationErrors
from middlewared.utils import filter_list, MIDDLEWARE_RUN_DIR
from... | 7,600 | Python | .py | 168 | 31.238095 | 110 | 0.534711 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,778 | on_config_upload.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/on_config_upload.py | import subprocess
import sqlite3
from middlewared.service_exception import MatchNotFound
def on_config_upload(middleware, path):
# For SCALE, we have to enable/disable services based on the uploaded database
enable_disable_units = {'enable': [], 'disable': []}
conn = sqlite3.connect(path)
try:
... | 2,293 | Python | .py | 53 | 32.566038 | 115 | 0.595067 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,779 | systemd_linux.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/systemd_linux.py | from middlewared.service import private, Service
class ServiceService(Service):
@private
async def systemd_units(self, name):
service = await self.middleware.call('service.object', name)
if service.systemd_unit == NotImplemented:
return []
else:
return [service... | 373 | Python | .py | 9 | 33.888889 | 79 | 0.684211 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,780 | utils.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/utils.py | import enum
from middlewared.utils.privilege import credential_has_full_admin
class ServiceWriteRole(enum.Enum):
CIFS = 'SHARING_SMB_WRITE'
NFS = 'SHARING_NFS_WRITE'
ISCSITARGET = 'SHARING_ISCSI_WRITE'
FTP = 'SHARING_FTP_WRITE'
def app_has_write_privilege_for_service(
app: object | None,
ser... | 917 | Python | .py | 27 | 28.148148 | 70 | 0.713636 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,781 | snmp.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/snmp.py | from .base import SimpleService
class SNMPService(SimpleService):
name = "snmp"
etc = ["snmpd"]
systemd_unit = "snmpd"
async def systemd_extra_units(self):
return ["snmp-agent"]
async def start(self):
await super().start()
await self._systemd_unit("snmp-agent", "start")... | 432 | Python | .py | 13 | 26.769231 | 55 | 0.633495 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,782 | ssh.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/ssh.py | from .base import SimpleService
class SSHService(SimpleService):
name = "ssh"
reloadable = True
etc = ["ssh"]
systemd_unit = "ssh"
async def after_start(self):
await self.middleware.call("ssh.save_keys")
async def after_reload(self):
await self.middleware.call("ssh.save_key... | 324 | Python | .py | 10 | 26.8 | 51 | 0.678571 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,783 | incus.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/incus.py | import os
import re
import signal
from pystemd.systemd1 import Unit
from middlewared.plugins.service_.services.base import SimpleService
from middlewared.plugins.virt.websocket import IncusWS
RE_DNSMASQ_PID = re.compile(r'^pid: (\d+)', flags=re.M)
class IncusService(SimpleService):
name = "incus"
etc = [... | 1,320 | Python | .py | 34 | 30.235294 | 72 | 0.626959 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,784 | netbios.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/netbios.py | from .base import SimpleService
class NetBIOSService(SimpleService):
name = "nmbd"
systemd_unit = "nmbd"
| 116 | Python | .py | 4 | 25.25 | 36 | 0.752294 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,785 | sssd.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/sssd.py | from .base import SimpleService
class SSSDService(SimpleService):
name = "sssd"
systemd_unit = "sssd"
async def before_start(self):
await self.middleware.call('ldap.create_sssd_dirs')
| 208 | Python | .py | 6 | 29.666667 | 59 | 0.722222 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,786 | nscd.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/nscd.py | from .base import SimpleService
class NSCDService(SimpleService):
name = "nscd"
reloadable = True
etc = ["nscd"]
systemd_unit = "nscd"
| 155 | Python | .py | 6 | 21.5 | 33 | 0.689655 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,787 | wsd.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/wsd.py | from .base import SimpleService
class WSDService(SimpleService):
name = "wsdd"
etc = ["wsd"]
systemd_unit = "wsdd"
| 131 | Python | .py | 5 | 22 | 32 | 0.688525 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,788 | netdata.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/netdata.py | from middlewared.plugins.service_.services.base import SimpleService
class NetdataService(SimpleService):
name = 'netdata'
etc = ['netdata']
restartable = True
systemd_unit = 'netdata'
| 205 | Python | .py | 6 | 29.833333 | 68 | 0.748718 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,789 | base_state.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/base_state.py | from collections import namedtuple
import logging
logger = logging.getLogger(__name__)
ServiceState = namedtuple("ServiceState", ["running", "pids"])
| 152 | Python | .py | 4 | 36.5 | 62 | 0.787671 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,790 | mdns.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/mdns.py | from .base import SimpleService
class MDNSService(SimpleService):
name = "mdns"
reloadable = True
etc = ["mdns"]
systemd_unit = "avahi-daemon"
async def start(self):
return await self._systemd_unit("avahi-daemon", "start")
async def reload(self):
announce = (await self.midd... | 595 | Python | .py | 15 | 32.6 | 103 | 0.657941 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,791 | ftp.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/ftp.py | from .base import SimpleService
class FTPService(SimpleService):
name = "ftp"
reloadable = True
etc = ["ftp"]
systemd_unit = "proftpd"
| 155 | Python | .py | 6 | 21.5 | 32 | 0.689655 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,792 | base.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/base.py | import logging
import select
import subprocess
from pystemd.base import SDObject
from pystemd.dbusexc import DBusUnknownObjectError
from pystemd.dbuslib import DBus
from pystemd.systemd1 import Unit
from systemd import journal
from middlewared.utils import run
from .base_interface import ServiceInterface, Identifiab... | 5,372 | Python | .py | 129 | 31.209302 | 126 | 0.601578 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,793 | all.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/all.py | from .cifs import CIFSService
from .docker import DockerService
from .ftp import FTPService
from .incus import IncusService
from .iscsitarget import ISCSITargetService
from .mdns import MDNSService
from .netbios import NetBIOSService
from .netdata import NetdataService
from .nfs import NFSService
from .nscd import NSCD... | 1,907 | Python | .py | 83 | 19.156627 | 65 | 0.78595 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,794 | iscsitarget.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/iscsitarget.py | import asyncio
from middlewared.utils import run
from .base import SimpleService
class ISCSITargetService(SimpleService):
name = "iscsitarget"
reloadable = True
systemd_async_start = True
etc = ["scst", "scst_targets"]
systemd_unit = "scst"
async def _wait_to_avoid_states(self, states, re... | 2,702 | Python | .py | 53 | 41 | 111 | 0.647706 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,795 | idmap.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/idmap.py | from .base import SimpleService
class IdmapService(SimpleService):
name = "idmap"
reloadable = True
restartable = True
systemd_unit = "winbind"
async def healthy(self):
return await self.middleware.call("smb.configure_wait")
async def start(self):
if not await self.healthy()... | 691 | Python | .py | 20 | 26.85 | 63 | 0.639939 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,796 | openipmi.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/openipmi.py | from middlewared.plugins.service_.services.base import SimpleService
class OpenIpmiService(SimpleService):
name = "openipmi"
systemd_unit = "openipmi"
| 161 | Python | .py | 4 | 36.75 | 68 | 0.8 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,797 | base_interface.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/base_interface.py | class ServiceInterface:
name = NotImplemented
etc = []
restartable = False # Implements `restart` method instead of `stop` + `start`
reloadable = False # Implements `reload` method
deprecated = False # Alert if service is running
def __init__(self, middleware):
self.middleware = mid... | 1,407 | Python | .py | 45 | 24.288889 | 82 | 0.677852 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,798 | truecommand.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/truecommand.py | from middlewared.plugins.truecommand.utils import WIREGUARD_INTERFACE_NAME
from .base import SimpleService
class TruecommandService(SimpleService):
name = 'truecommand'
etc = ['rc', 'truecommand']
systemd_unit = f'wg-quick@{WIREGUARD_INTERFACE_NAME}'
| 268 | Python | .py | 6 | 40.833333 | 74 | 0.782101 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |
24,799 | nfs.py | truenas_middleware/src/middlewared/middlewared/plugins/service_/services/nfs.py | import os
from .base import SimpleService
class NFSService(SimpleService):
name = "nfs"
reloadable = True
systemd_unit_timeout = 10
etc = ["nfsd"]
systemd_unit = "nfs-server"
def check_exportsd_dir(self):
exports = list()
try:
with os.scandir('/etc/exports.d') a... | 1,795 | Python | .py | 37 | 40 | 115 | 0.659039 | truenas/middleware | 2,277 | 481 | 13 | LGPL-3.0 | 9/5/2024, 5:13:34 PM (Europe/Amsterdam) |