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,500
disk.py
truenas_middleware/src/middlewared/middlewared/plugins/disk.py
import errno import re import subprocess from sqlalchemy.exc import IntegrityError from middlewared.utils import ProductType from middlewared.schema import accepts, Bool, Datetime, Dict, Int, Patch, Str from middlewared.service import filterable, private, CallError, CRUDService, ValidationError import middlewared.sqla...
20,572
Python
.py
420
38.366667
124
0.593006
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,501
idmap.py
truenas_middleware/src/middlewared/middlewared/plugins/idmap.py
import enum import asyncio import errno import datetime import wbclient from middlewared.schema import accepts, Bool, Dict, Int, Password, Patch, Ref, Str, LDAP_DN, OROperator from middlewared.service import CallError, CRUDService, job, private, ValidationErrors, filterable from middlewared.service_exception import Ma...
52,618
Python
.py
1,087
36.940202
140
0.581772
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,502
sysdataset.py
truenas_middleware/src/middlewared/middlewared/plugins/sysdataset.py
import errno import json import os import shutil import subprocess import threading import uuid from contextlib import contextmanager, suppress from pathlib import Path import middlewared.sqlalchemy as sa from middlewared.plugins.boot import BOOT_POOL_NAME_VALID from middlewared.plugins.system_dataset.hierarchy impo...
33,484
Python
.py
655
39.105344
123
0.594671
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,503
support.py
truenas_middleware/src/middlewared/middlewared/plugins/support.py
import asyncio import errno import json import shutil import tempfile import time import aiohttp import async_timeout import requests from middlewared.pipe import Pipes from middlewared.plugins.system.utils import DEBUG_MAX_SIZE from middlewared.schema import accepts, Bool, Dict, Int, List, Password, returns, Str fro...
12,767
Python
.py
306
30.650327
106
0.571763
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,504
vmware.py
truenas_middleware/src/middlewared/middlewared/plugins/vmware.py
from collections import defaultdict from datetime import datetime import errno import socket import ssl import uuid from middlewared.async_validators import resolve_hostname from middlewared.schema import accepts, Any, Bool, Dict, Int, Str, Password, Patch from middlewared.service import CallError, CRUDService, job, p...
27,005
Python
.py
582
32.316151
119
0.544854
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,505
rsync.py
truenas_middleware/src/middlewared/middlewared/plugins/rsync.py
# Copyright 2017 iXsystems, Inc. # All rights reserved # # Redistribution and use in source and binary forms, with or without # modification, are permitted providing that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
30,684
Python
.py
611
35
120
0.529245
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,506
nfs.py
truenas_middleware/src/middlewared/middlewared/plugins/nfs.py
import enum import errno import ipaddress import itertools import os import shutil from middlewared.common.listen import SystemServiceListenMultipleDelegate from middlewared.schema import accepts, Bool, Dict, Dir, Int, IPAddr, List, Patch, returns, Str from middlewared.async_validators import check_path_resides_within...
39,424
Python
.py
811
36.086313
124
0.576942
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,507
dns_client.py
truenas_middleware/src/middlewared/middlewared/plugins/dns_client.py
import asyncio from dns.asyncresolver import Resolver from io import StringIO from middlewared.service import private, Service, ValidationError from middlewared.schema import accepts, returns, IPAddr, Dict, Int, List, Str, Ref, OROperator from middlewared.utils import filter_list class DNSClient(Service): class ...
8,045
Python
.py
208
24.841346
117
0.474978
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,508
update.py
truenas_middleware/src/middlewared/middlewared/plugins/update.py
from middlewared.schema import accepts, Bool, Dict, Str from middlewared.service import job, private, CallError, Service, pass_app import middlewared.sqlalchemy as sa from middlewared.plugins.update_.utils import UPLOAD_LOCATION from middlewared.utils import PRODUCT from middlewared.utils.time_utils import utc_now imp...
17,736
Python
.py
399
33.882206
120
0.602714
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,509
smart.py
truenas_middleware/src/middlewared/middlewared/plugins/smart.py
import asyncio from datetime import datetime, timedelta, timezone import functools import re import time import json from typing import Any from humanize import ordinal from middlewared.common.smart.smartctl import SMARTCTL_POWERMODES from middlewared.plugins.smart_.schedule import SMARTD_SCHEDULE_PIECES, smartd_sche...
28,920
Python
.py
680
30.007353
121
0.535924
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,510
tunables.py
truenas_middleware/src/middlewared/middlewared/plugins/tunables.py
import contextlib import errno import os import subprocess from middlewared.schema import accepts, Bool, Dict, Int, Patch, returns, Str, ValidationErrors from middlewared.service import CRUDService, job, private import middlewared.sqlalchemy as sa from middlewared.utils import run class TunableModel(sa.Model): _...
8,735
Python
.py
197
34.720812
119
0.591777
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,511
post_install.py
truenas_middleware/src/middlewared/middlewared/plugins/post_install.py
import json import os import jsonschema from middlewared.service import Service PATH = "/data/post_install.json" SCHEMA = { "type": "object", "additionalProperties": False, "properties": { "network_interfaces": { "type": "array", "items": { "type": "object...
2,441
Python
.py
65
23.046154
113
0.456816
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,512
ups.py
truenas_middleware/src/middlewared/middlewared/plugins/ups.py
import csv import functools import glob import io import os import re import syslog from middlewared.schema import accepts, Bool, Dict, Int, List, Patch, returns, Str from middlewared.service import private, SystemServiceService, ValidationErrors import middlewared.sqlalchemy as sa from middlewared.utils import run fr...
16,430
Python
.py
343
35.653061
120
0.56114
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,513
truenas.py
truenas_middleware/src/middlewared/middlewared/plugins/truenas.py
import errno import os from ixhardware import TRUENAS_UNKNOWN, get_chassis_hardware from middlewared.plugins.truecommand.enums import Status as TrueCommandStatus from middlewared.schema import accepts, Bool, Patch, returns, Str from middlewared.service import cli_private, job, no_auth_required, private, Service from ...
4,219
Python
.py
108
30.759259
111
0.628236
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,514
alert.py
truenas_middleware/src/middlewared/middlewared/plugins/alert.py
from dataclasses import dataclass from collections import defaultdict, namedtuple import copy from datetime import datetime, timezone import errno from itertools import zip_longest import os import textwrap import time import uuid import html2text from truenas_api_client import ReserveFDException from middlewared.al...
46,090
Python
.py
996
33.319277
117
0.573844
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,515
mail.py
truenas_middleware/src/middlewared/middlewared/plugins/mail.py
from middlewared.schema import accepts, Bool, Dict, Int, List, Password, Patch, Ref, returns, Str from middlewared.service import CallError, ConfigService, ValidationErrors, job, periodic, private import middlewared.sqlalchemy as sa from middlewared.utils import ProductName, BRAND from middlewared.utils.mako import get...
18,573
Python
.py
437
30.620137
118
0.558047
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,516
builtin_administrator.py
truenas_middleware/src/middlewared/middlewared/plugins/account_/builtin_administrator.py
from middlewared.api import api_method from middlewared.api.current import GroupHasPasswordEnabledUserArgs, GroupHasPasswordEnabledUserResult from middlewared.plugins.account import unixhash_is_valid from middlewared.service import filter_list, Service, private class GroupService(Service): @api_method(GroupHasPa...
1,821
Python
.py
38
37.578947
102
0.625847
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,517
sync_builtin.py
truenas_middleware/src/middlewared/middlewared/plugins/account_/sync_builtin.py
from collections import defaultdict import itertools from middlewared.service import private, Service def read_file(path): with open(path) as f: return list(filter(None, f.read().strip().split("\n"))) class UserService(Service): @private def sync_builtin(self): smb_builtins = [ ...
10,524
Python
.py
262
22.381679
103
0.407549
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,518
privilege_roles.py
truenas_middleware/src/middlewared/middlewared/plugins/account_/privilege_roles.py
from middlewared.role import ROLES from middlewared.service import Service, filterable, filterable_returns, filter_list, no_authz_required from middlewared.schema import Bool, Dict, List, Str class PrivilegeService(Service): class Config: namespace = "privilege" cli_namespace = "auth.privilege" ...
1,299
Python
.py
37
26.189189
103
0.60415
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,519
constants.py
truenas_middleware/src/middlewared/middlewared/plugins/account_/constants.py
ADMIN_UID = 950 ADMIN_GID = 950 SKEL_PATH = '/etc/skel/' # TODO evaluate whether this is still needed # TrueNAS historically used /nonexistent as the default home directory for new # users. The nonexistent directory has caused problems when # 1) an admin chooses to create it from shell # 2) PAM checks for home direct...
706
Python
.py
14
49.357143
78
0.780029
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,520
2fa.py
truenas_middleware/src/middlewared/middlewared/plugins/account_/2fa.py
import errno import pyotp from middlewared.api import api_method from middlewared.api.current import * from middlewared.service import CallError, no_authz_required, pass_app, private, Service from middlewared.utils import ProductName from middlewared.utils.privilege import app_credential_full_admin_or_user class Use...
7,920
Python
.py
157
40.050955
112
0.641602
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,521
internal_cache.py
truenas_middleware/src/middlewared/middlewared/plugins/account_/internal_cache.py
import errno from middlewared.service import CallError, private, Service class UserService(Service): SYS_USERS = {} @private async def get_builtin_user_id(self, username): if not self.SYS_USERS: UserService.SYS_USERS = { u['username']: u['uid'] for u in await self.mi...
1,160
Python
.py
30
28.3
88
0.564674
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,522
privilege.py
truenas_middleware/src/middlewared/middlewared/plugins/account_/privilege.py
import enum import errno import wbclient from middlewared.api import api_method from middlewared.api.current import * from middlewared.plugins.account import unixhash_is_valid from middlewared.service import CallError, CRUDService, filter_list, private, ValidationErrors from middlewared.service_exception import MatchN...
17,109
Python
.py
374
33.459893
118
0.571703
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,523
sec.py
truenas_middleware/src/middlewared/middlewared/plugins/nfs_/sec.py
from middlewared.service import private, Service from middlewared.plugins.nfs import NFSProtocol class NFSService(Service): class Config: service = "nfs" service_verb = "restart" datastore_prefix = "nfs_srv_" datastore_extend = 'nfs.nfs_extend' @private async def sec(self...
647
Python
.py
18
26.666667
56
0.584936
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,524
status.py
truenas_middleware/src/middlewared/middlewared/plugins/nfs_/status.py
from middlewared.plugins.nfs import NFSServicePathInfo from middlewared.schema import accepts, Int, returns, Str, Dict from middlewared.service import Service, private, filterable, filterable_returns from middlewared.utils import filter_list from middlewared.service_exception import CallError from contextlib import sup...
8,651
Python
.py
195
32.261538
121
0.563546
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,525
utils.py
truenas_middleware/src/middlewared/middlewared/plugins/nfs_/utils.py
import re RE_DOMAIN_WILDCARD = re.compile(r'\*|\?|\[|\]') def get_domain(hostname): """ return the 'domain' part of the hostname e.g. gruff.billy.goat will return 'billy.goat' and gruffbillygoat will return None """ lst = hostname.split('.', 1) if len(lst) > 1: return lst[1] ...
973
Python
.py
29
28.275862
86
0.673426
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,526
debug.py
truenas_middleware/src/middlewared/middlewared/plugins/nfs_/debug.py
from middlewared.schema import accepts, List, Str, Dict from middlewared.service import Service, private from contextlib import suppress import os import enum class NFS_DBGFLAGS(enum.Enum): # include/uapi/linux/nfs_fs.h NONE = 0x0000 VFS = 0x0001 DIRCACHE = 0x0002 LOOKUPCACHE = 0x0004 PAGECAC...
4,344
Python
.py
137
23.131387
99
0.566196
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,527
fs_attachment_delegate.py
truenas_middleware/src/middlewared/middlewared/plugins/nfs_/fs_attachment_delegate.py
from middlewared.common.attachment import LockableFSAttachmentDelegate from middlewared.plugins.nfs import SharingNFSService class NFSFSAttachmentDelegate(LockableFSAttachmentDelegate): name = 'nfs' title = 'NFS Share' service = 'nfs' service_class = SharingNFSService resource_name = 'path' ...
565
Python
.py
12
42.583333
107
0.787934
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,528
port_attachments.py
truenas_middleware/src/middlewared/middlewared/plugins/nfs_/port_attachments.py
from middlewared.common.ports import ServicePortDelegate class NFSServicePortDelegate(ServicePortDelegate): bind_address_field = 'bindip' name = 'nfs' namespace = 'nfs' port_fields = ['mountd_port', 'rpcstatd_port', 'rpclockd_port'] title = 'NFS Service' def bind_address(self, config): ...
1,019
Python
.py
23
36.521739
98
0.662955
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,529
status.py
truenas_middleware/src/middlewared/middlewared/plugins/ftp_/status.py
from middlewared.service import Service, private from middlewared.schema import Int, accepts, returns from middlewared.utils.network_.procfs import read_proc_net class FTPService(Service): @private @accepts(roles=['SHARING_FTP_READ']) @returns(Int('number_of_connections')) def connection_count(self):...
998
Python
.py
22
37.090909
104
0.624486
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,530
attachments.py
truenas_middleware/src/middlewared/middlewared/plugins/ftp_/attachments.py
from middlewared.common.ports import ServicePortDelegate class FTPServicePortDelegate(ServicePortDelegate): name = 'FTP' namespace = 'ftp' port_fields = ['port'] title = 'FTP Service' async def setup(middleware): await middleware.call('port.register_attachment_delegate', FTPServicePortDelegate(...
333
Python
.py
8
37.5
98
0.778125
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,531
cert_attachment.py
truenas_middleware/src/middlewared/middlewared/plugins/ftp_/cert_attachment.py
from middlewared.common.attachment.certificate import CertificateServiceAttachmentDelegate class FTPCertificateAttachment(CertificateServiceAttachmentDelegate): CERT_FIELD = 'ssltls_certificate' HUMAN_NAME = 'FTP Service' SERVICE = 'ftp' async def setup(middleware): await middleware.call('certifica...
392
Python
.py
7
52
107
0.834211
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,532
lan.py
truenas_middleware/src/middlewared/middlewared/plugins/ipmi_/lan.py
from subprocess import run, DEVNULL from functools import cache from middlewared.schema import accepts, Bool, Dict, Int, IPAddr, List, Password, Ref, returns, Str from middlewared.service import private, CallError, filterable_returns, CRUDService, ValidationError, ValidationErrors from middlewared.utils import filter_...
9,391
Python
.py
194
37.93299
118
0.580452
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,533
chassis.py
truenas_middleware/src/middlewared/middlewared/plugins/ipmi_/chassis.py
from subprocess import run, DEVNULL from middlewared.service import Service from middlewared.schema import Str, Dict, accepts, returns class IpmiChassisService(Service): class Config: namespace = 'ipmi.chassis' cli_namespace = 'service.ipmi.chassis' @accepts(roles=['IPMI_READ']) @return...
1,757
Python
.py
43
31.651163
91
0.570088
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,534
mc.py
truenas_middleware/src/middlewared/middlewared/plugins/ipmi_/mc.py
from subprocess import run from middlewared.service import Service from middlewared.schema import accepts, returns, Dict class IpmiMcService(Service): class Config: namespace = 'ipmi.mc' cli_namespace = 'service.ipmi.mc' @accepts(roles=['IPMI_READ']) @returns(Dict('mc_info', additional_...
1,640
Python
.py
39
30.102564
73
0.53325
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,535
sensors.py
truenas_middleware/src/middlewared/middlewared/plugins/ipmi_/sensors.py
from random import uniform from subprocess import run from time import sleep from middlewared.service import Service, filterable, filterable_returns, private from middlewared.utils import filter_list from middlewared.schema import List, Dict def get_sensors_data(): cmd = [ 'ipmi-sensors', '--comm...
3,311
Python
.py
73
32.726027
110
0.549457
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,536
sel.py
truenas_middleware/src/middlewared/middlewared/plugins/ipmi_/sel.py
from subprocess import run from middlewared.service import job, Service, filterable, filterable_returns from middlewared.utils import filter_list from middlewared.schema import accepts, returns, Dict from middlewared.service_exception import CallError SEL_LOCK = 'sel_lock' def get_sel_data(data): cmd = ['ipmi-s...
3,051
Python
.py
68
35.632353
119
0.597236
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,537
rest.py
truenas_middleware/src/middlewared/middlewared/plugins/test/rest.py
import json import time from middlewared.schema import accepts, Any from middlewared.service import job, Service class RestTestService(Service): class Config: private = True @accepts(Any("arg")) @job(pipes=["input"]) def test_input_pipe(self, job, arg): return json.dumps(arg) + job.p...
1,684
Python
.py
44
31.227273
87
0.623313
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,538
mock.py
truenas_middleware/src/middlewared/middlewared/plugins/test/mock.py
from middlewared.service import CallError, Service class TestService(Service): class Config: private = True async def set_mock(self, name, args, description): if isinstance(description, str): exec(description) try: method = locals()["mock"] ...
1,252
Python
.py
31
29.322581
100
0.587799
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,539
log.py
truenas_middleware/src/middlewared/middlewared/plugins/test/log.py
from middlewared.service import Service class TestService(Service): class Config: private = True def notify_test_start(self, name): self.middleware.logger.debug("Starting integration test %s", name) def notify_test_end(self, name): self.middleware.logger.debug("Ending integration...
337
Python
.py
8
36.125
74
0.72
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,540
crud.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud_sync_/crud.py
from middlewared.schema import accepts, Dict, Int, Str from middlewared.service import item_method, Service class CloudSyncService(Service): @item_method @accepts( Int("id"), Dict( "cloud_sync_restore", Str("description"), Str("transfer_mode", enum=["SYNC",...
1,320
Python
.py
32
31.9375
108
0.575781
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,541
remotes.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud/remotes.py
import os from middlewared.rclone.base import BaseRcloneRemote from middlewared.utils.plugins import load_modules, load_classes from middlewared.utils.python import get_middlewared_dir REMOTES = {} remote_classes = [] for module in load_modules(os.path.join(get_middlewared_dir(), "rclone", "remote")): for cls i...
534
Python
.py
13
37.153846
84
0.75534
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,542
crud.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud/crud.py
import os import shlex import textwrap from middlewared.plugins.cloud.remotes import REMOTES from middlewared.plugins.zfs_.utils import zvol_path_to_name from middlewared.schema import Bool, Str from middlewared.service import CallError, private from middlewared.utils.privilege import credential_has_full_admin from mi...
4,350
Python
.py
81
41.234568
118
0.59901
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,543
path.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud/path.py
import os import stat from middlewared.service import CallError def get_remote_path(provider, attributes): remote_path = attributes["folder"].rstrip("/") if not remote_path: remote_path = "/" if provider.buckets: remote_path = f"{attributes['bucket']}/{remote_path.lstrip('/')}" return...
973
Python
.py
22
38
99
0.691737
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,544
model.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud/model.py
from sqlalchemy.ext.declarative import declared_attr from middlewared.schema import Bool, Cron, Dict, Int, List, Str import middlewared.sqlalchemy as sa from middlewared.validators import Range, Time class CloudTaskModelMixin: id = sa.Column(sa.Integer(), primary_key=True) description = sa.Column(sa.String(1...
2,108
Python
.py
49
36.979592
91
0.646199
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,545
ssh_connections.py
truenas_middleware/src/middlewared/middlewared/plugins/keychain_/ssh_connections.py
from middlewared.api import api_method from middlewared.api.current import KeychainCredentialSetupSSHConnectionArgs, KeychainCredentialSetupSSHConnectionResult from middlewared.service import Service, ValidationErrors class KeychainCredentialService(Service): @api_method(KeychainCredentialSetupSSHConnectionArgs,...
4,609
Python
.py
85
39.882353
120
0.573992
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,546
task_retention.py
truenas_middleware/src/middlewared/middlewared/plugins/snapshot_/task_retention.py
from collections import defaultdict from middlewared.schema import Dict, Int, Patch, returns from middlewared.service import accepts, item_method, Service class PeriodicSnapshotTaskService(Service): class Config: namespace = "pool.snapshottask" @item_method @accepts( Int("id"), ...
2,073
Python
.py
48
34.1875
110
0.640338
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,547
removal_date.py
truenas_middleware/src/middlewared/middlewared/plugins/snapshot_/removal_date.py
import hashlib from middlewared.service import Service, job, private class PeriodicSnapshotTaskService(Service): class Config: namespace = "pool.snapshottask" @private async def removal_date_property(self): host_id = await self.middleware.call("system.host_id") return f"org.true...
672
Python
.py
16
35.875
117
0.678462
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,548
state.py
truenas_middleware/src/middlewared/middlewared/plugins/zettarepl_/state.py
from collections import defaultdict import re from truenas_api_client import json as ejson from middlewared.service import periodic, Service from middlewared.utils.service.task_state import TaskStateMixin RE_REPLICATION_TASK_ID = re.compile(r"replication_task_([0-9]+)$") class ZettareplService(Service, TaskStateMi...
5,200
Python
.py
109
37.440367
110
0.611946
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,549
util.py
truenas_middleware/src/middlewared/middlewared/plugins/zettarepl_/util.py
from types import SimpleNamespace from zettarepl.replication.task.dataset import get_source_dataset_base, get_target_dataset from middlewared.service import Service class ZettareplService(Service): class Config: private = True async def reverse_source_target_datasets(self, source_datasets, target_...
810
Python
.py
18
34.333333
110
0.657761
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,550
snapshot_create.py
truenas_middleware/src/middlewared/middlewared/plugins/zettarepl_/snapshot_create.py
from middlewared.service import Service from zettarepl.snapshot.create import create_snapshot from zettarepl.snapshot.snapshot import Snapshot from zettarepl.transport.local import LocalShell class ZettareplService(Service): def create_recursive_snapshot_with_exclude(self, dataset, snapshot, exclude): cr...
396
Python
.py
7
53.428571
85
0.821244
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,551
snapshot_removal_date.py
truenas_middleware/src/middlewared/middlewared/plugins/zettarepl_/snapshot_removal_date.py
from collections import defaultdict import subprocess from dateutil.tz import tzlocal import isodate from middlewared.service import Service from middlewared.utils.time_utils import utc_now from zettarepl.snapshot.list import list_snapshots from zettarepl.snapshot.name import parse_snapshot_name from zettarepl.snaps...
7,939
Python
.py
147
38.877551
119
0.582066
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,552
vendor.py
truenas_middleware/src/middlewared/middlewared/plugins/system_vendor/vendor.py
import json import os from middlewared.api import api_method from middlewared.api.current import ( VendorNameArgs, VendorNameResult, UnvendorArgs, UnvendorResult, IsVendoredArgs, IsVendoredResult ) from middlewared.service import Service SENTINEL_FILE_PATH = '/data/.vendor' def get_vendor() -> str | None: ...
1,542
Python
.py
37
34.513514
114
0.693905
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,553
hierarchy.py
truenas_middleware/src/middlewared/middlewared/plugins/system_dataset/hierarchy.py
import os from .utils import SYSDATASET_PATH SYSTEM_DATASET_JSON_SCHEMA = { '$schema': 'http://json-schema.org/draft-07/schema#', 'description': 'Schema for the output of get_system_dataset_spec function', 'type': 'array', 'items': { 'type': 'object', 'properties': { 'name...
5,360
Python
.py
173
15.641618
79
0.320726
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,554
ipa_join_mixin.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/ipa_join_mixin.py
import base64 import json import os import subprocess from dataclasses import asdict from functools import cache from middlewared.job import Job from middlewared.plugins.ldap_.constants import SERVER_TYPE_FREEIPA from middlewared.utils.directoryservices import ( ipa, ipa_constants ) from middlewared.utils.director...
22,940
Python
.py
468
37.017094
106
0.599375
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,555
ipa_health_mixin.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/ipa_health_mixin.py
import ldap import os from middlewared.utils.directoryservices import ( ipa_constants, ldap_utils ) from middlewared.utils.directoryservices.health import ( IPAHealthCheckFailReason, IPAHealthError ) from middlewared.plugins.ldap_.ldap_client import LdapClient from middlewared.service_exception import Call...
5,685
Python
.py
127
32.732283
99
0.596282
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,556
secrets.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/secrets.py
import enum import json import struct import subprocess from base64 import b64encode, b64decode from middlewared.service import Service from middlewared.service_exception import CallError, MatchNotFound from middlewared.utils import filter_list from middlewared.utils.tdb import ( get_tdb_handle, TDBDataType, ...
8,235
Python
.py
179
36.642458
99
0.63175
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,557
activedirectory_join_mixin.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/activedirectory_join_mixin.py
import os import subprocess import wbclient from middlewared.job import Job from middlewared.plugins.smb_.constants import SMBCmd, SMBPath from middlewared.service_exception import CallError, MatchNotFound from middlewared.utils.directoryservices.ad import ( get_domain_info, lookup_dc ) from middlewared.utils....
14,792
Python
.py
336
33.050595
108
0.591929
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,558
ldap_join_mixin.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/ldap_join_mixin.py
from middlewared.utils.directoryservices.constants import DSType class LDAPJoinMixin: def _ldap_activate(self) -> None: for etc_file in DSType.LDAP.etc_files: self.middleware.call_sync('etc.generate', etc_file) ldap_config = self.middleware.call_sync('ldap.config') self.middl...
537
Python
.py
10
45.4
77
0.683908
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,559
cache.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/cache.py
from middlewared.schema import Str, Ref, Int, Dict, Bool, accepts from middlewared.service import Service, job from middlewared.service_exception import CallError, MatchNotFound from middlewared.utils.directoryservices.constants import ( DSStatus, DSType ) from middlewared.utils.nss.pwd import iterpw from middlewar...
10,743
Python
.py
240
32.3875
110
0.565338
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,560
kerberos_health_mixin.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/kerberos_health_mixin.py
import os from middlewared.utils.directoryservices import ( krb5, krb5_constants ) from middlewared.utils.directoryservices.health import ( KRB5HealthCheckFailReason, KRB5HealthError ) class KerberosHealthMixin: """ Base directory services class. This provides common status-related code for direc...
3,770
Python
.py
89
30.505618
100
0.59793
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,561
util_cache.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/util_cache.py
import enum import os from collections import defaultdict from collections.abc import Iterable from middlewared.utils.directoryservices.constants import ( DSType ) from middlewared.job import Job from middlewared.utils import filter_list from middlewared.utils.itertools import batched from middlewared.utils.nss im...
13,397
Python
.py
331
29.691843
116
0.580464
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,562
health.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/health.py
import os import stat from .activedirectory_health_mixin import ADHealthMixin from .ipa_health_mixin import IPAHealthMixin from .kerberos_health_mixin import KerberosHealthMixin from .ldap_health_mixin import LDAPHealthMixin from middlewared.plugins.ldap_.constants import SERVER_TYPE_FREEIPA from middlewared.service i...
6,272
Python
.py
152
30.677632
104
0.621409
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,563
join.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/join.py
import ipaddress from .activedirectory_join_mixin import ADJoinMixin from .ipa_join_mixin import IPAJoinMixin from .ldap_join_mixin import LDAPJoinMixin from middlewared.job import Job from middlewared.plugins.ldap_.constants import SERVER_TYPE_FREEIPA from middlewared.service import job, Service from middlewared.serv...
11,605
Python
.py
251
34.115538
110
0.5943
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,564
activedirectory_health_mixin.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/activedirectory_health_mixin.py
import subprocess from base64 import b64decode from middlewared.utils.directoryservices.ad import get_domain_info from middlewared.utils.directoryservices.ad_constants import ( MACHINE_ACCOUNT_KT_NAME, MAX_SERVER_TIME_OFFSET, ) from middlewared.utils.directoryservices.constants import DSType from middlewared.u...
9,567
Python
.py
210
33.542857
111
0.606883
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,565
ldap_health_mixin.py
truenas_middleware/src/middlewared/middlewared/plugins/directoryservices_/ldap_health_mixin.py
from middlewared.utils.directoryservices.health import ( LDAPHealthCheckFailReason, LDAPHealthError ) from middlewared.service_exception import CallError class LDAPHealthMixin: def _recover_ldap_config(self) -> list[dict]: return self.middleware.call_sync('etc.generate', 'ldap') def _recover_...
2,567
Python
.py
56
35.232143
101
0.628549
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,566
restore.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud_backup/restore.py
from middlewared.async_validators import check_path_resides_within_volume from middlewared.plugins.cloud_backup.restic import get_restic_config, run_restic from middlewared.schema import accepts, Dict, Int, List, Str from middlewared.service import job, Service, ValidationErrors from middlewared.validators import NotMa...
1,831
Python
.py
40
37.6
110
0.644944
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,567
crud.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud_backup/crud.py
from middlewared.alert.base import Alert, AlertCategory, AlertClass, AlertLevel, OneShotAlertClass from middlewared.common.attachment import LockableFSAttachmentDelegate from middlewared.plugins.cloud.crud import CloudTaskServiceMixin from middlewared.plugins.cloud.model import CloudTaskModelMixin, cloud_task_schema fr...
6,256
Python
.py
132
39.606061
115
0.675378
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,568
sync.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud_backup/sync.py
import asyncio import itertools from middlewared.plugins.cloud.path import check_local_path from middlewared.plugins.cloud_backup.restic import get_restic_config, run_restic from middlewared.plugins.zfs_.utils import zvol_name_to_path, zvol_path_to_name from middlewared.schema import accepts, Bool, Dict, Int from midd...
5,768
Python
.py
135
31.333333
111
0.574795
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,569
restic.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud_backup/restic.py
import asyncio from dataclasses import dataclass import subprocess from middlewared.plugins.cloud.path import get_remote_path from middlewared.plugins.cloud.remotes import REMOTES from middlewared.service import CallError from middlewared.utils import Popen @dataclass class ResticConfig: cmd: list[str] env: ...
2,288
Python
.py
57
32.877193
103
0.655375
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,570
init.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud_backup/init.py
import subprocess from middlewared.plugins.cloud_backup.restic import get_restic_config from middlewared.service import CallError, Service, private class IncorrectPassword(CallError): pass class CloudBackupService(Service): class Config: cli_namespace = "task.cloud_backup" namespace = "clo...
2,600
Python
.py
61
30.721311
109
0.595871
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,571
snapshot.py
truenas_middleware/src/middlewared/middlewared/plugins/cloud_backup/snapshot.py
from datetime import datetime import json import subprocess from middlewared.plugins.cloud_backup.restic import get_restic_config from middlewared.schema import accepts, Datetime, Dict, Int, List, returns, Str from middlewared.service import CallError, job, Service from middlewared.validators import NotMatch class C...
4,179
Python
.py
103
29.495146
116
0.568574
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,572
sysctl_info.py
truenas_middleware/src/middlewared/middlewared/plugins/sysctl/sysctl_info.py
import os from middlewared.service import CallError, Service from middlewared.utils import run, MIDDLEWARE_RUN_DIR ZFS_MODULE_PARAMS_PATH = '/sys/module/zfs/parameters' DEFAULT_ARC_MAX_FILE = f'{MIDDLEWARE_RUN_DIR}/default_arc_max' class SysctlService(Service): class Config: private = True async d...
2,872
Python
.py
65
33.861538
105
0.59412
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,573
sync.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/sync.py
from middlewared.schema import accepts from middlewared.service import job, private, returns, Service from .git_utils import pull_clone_repository from .utils import OFFICIAL_LABEL, OFFICIAL_CATALOG_REPO, OFFICIAL_CATALOG_BRANCH class CatalogService(Service): SYNCED = False @private async def synced(se...
2,149
Python
.py
46
36.652174
116
0.643744
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,574
features.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/features.py
import errno import json import os from apps_schema.features import FEATURES from middlewared.service import CallError, private, Service from .apps_util import min_max_scale_version_check_update_impl class CatalogService(Service): @private def get_feature_map(self, cache=True): if cache and self.mi...
2,880
Python
.py
54
43.518519
115
0.645403
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,575
apps.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/apps.py
from middlewared.schema import accepts, Bool, Datetime, Dict, List, Ref, returns, Str from middlewared.service import filterable, filterable_returns, Service from middlewared.utils import filter_list class AppService(Service): class Config: cli_namespace = 'app' @filterable(roles=['CATALOG_READ']) ...
4,923
Python
.py
106
36.5
106
0.60175
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,576
apps_details.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/apps_details.py
import contextlib import json import os from apps_ci.names import CACHED_CATALOG_FILE_NAME from apps_validation.json_schema_utils import CATALOG_JSON_SCHEMA from catalog_reader.app_utils import get_app_details_base from catalog_reader.catalog import retrieve_train_names from catalog_reader.train_utils import get_train...
10,729
Python
.py
203
40.871921
120
0.606295
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,577
utils.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/utils.py
import os from middlewared.utils import MIDDLEWARE_RUN_DIR COMMUNITY_TRAIN = 'community' OFFICIAL_ENTERPRISE_TRAIN = 'enterprise' OFFICIAL_LABEL = 'TRUENAS' OFFICIAL_CATALOG_REPO = 'https://github.com/truenas/apps' OFFICIAL_CATALOG_BRANCH = 'master' TMP_IX_APPS_CATALOGS = os.path.join(MIDDLEWARE_RUN_DIR, 'ix-apps/ca...
413
Python
.py
10
39.4
75
0.778894
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,578
apps_util.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/apps_util.py
import errno import json import jsonschema import os import re from apps_ci.names import CACHED_VERSION_FILE_NAME from apps_validation.json_schema_utils import VERSION_VALIDATION_SCHEMA from catalog_reader.app import get_app_version_details as get_catalog_app_version_details from catalog_reader.questions import normal...
6,140
Python
.py
101
52.60396
120
0.696491
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,579
app_version.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/app_version.py
import errno import os import stat from catalog_reader.train_utils import get_train_path from middlewared.schema import accepts, Bool, Dict, List, returns, Str from middlewared.service import CallError, Service from .apps_util import get_app_details class CatalogService(Service): class Config: cli_nam...
3,149
Python
.py
66
39.212121
110
0.641276
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,580
git_utils.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/git_utils.py
import logging import threading import typing from collections import defaultdict from middlewared.service import CallError from middlewared.utils.git import clone_repository, checkout_repository, update_repo, validate_git_repo GIT_LOCK = defaultdict(threading.Lock) logger = logging.getLogger('catalog_utils') def ...
1,496
Python
.py
29
42.965517
117
0.672154
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,581
update.py
truenas_middleware/src/middlewared/middlewared/plugins/catalog/update.py
import os import middlewared.sqlalchemy as sa from middlewared.plugins.docker.state_utils import catalog_ds_path, CATALOG_DATASET_NAME from middlewared.schema import accepts, Dict, List, returns, Str from middlewared.service import ConfigService, private, ValidationErrors from middlewared.utils import ProductType fro...
5,279
Python
.py
125
32.28
113
0.617905
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,582
host_initiator.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/host_initiator.py
from middlewared.schema import accepts, Bool, Int, List from middlewared.service import CallError, Service, ServiceChangeMixin class iSCSIHostService(Service, ServiceChangeMixin): class Config: namespace = "iscsi.host" @accepts(Int("id"), roles=['SHARING_ISCSI_HOST_READ']) async def get_initiato...
2,434
Python
.py
46
40.391304
121
0.589571
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,583
iscsi_global.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/iscsi_global.py
import asyncio import re import socket import middlewared.sqlalchemy as sa from middlewared.async_validators import validate_port from middlewared.schema import Bool, Dict, Int, List, Str, accepts from middlewared.service import SystemServiceService, ValidationErrors, private from middlewared.utils import run from mid...
7,431
Python
.py
166
34.807229
116
0.609544
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,584
global_linux.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/global_linux.py
import glob import os from middlewared.schema import Bool, Dict, Int, Str from middlewared.service import filterable, filterable_returns, private, Service from middlewared.utils import filter_list, run class ISCSIGlobalService(Service): class Config: namespace = 'iscsi.global' @filterable(roles=['S...
8,550
Python
.py
163
38.386503
117
0.543912
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,585
initiator.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/initiator.py
import middlewared.sqlalchemy as sa from middlewared.schema import accepts, Dict, Int, List, Patch, Str from middlewared.service import CRUDService, private def initiator_summary(data): """Select a human-readable string representing this initiator""" if title := data.get('comment'): return title ...
3,826
Python
.py
97
31.195876
114
0.635088
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,586
extents.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/extents.py
import hashlib import os import pathlib import secrets import subprocess import uuid import middlewared.sqlalchemy as sa from middlewared.async_validators import check_path_resides_within_volume from middlewared.plugins.zfs_.utils import zvol_path_to_name from middlewared.schema import accepts, Bool, Dict, Int, Patch...
22,935
Python
.py
486
35.932099
133
0.579225
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,587
target_to_extent.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/target_to_extent.py
import asyncio import middlewared.sqlalchemy as sa from middlewared.schema import Bool, Dict, Int, Patch, accepts from middlewared.service import CallError, CRUDService, ValidationErrors, private class iSCSITargetToExtentModel(sa.Model): __tablename__ = 'services_iscsitargettoextent' __table_args__ = ( ...
10,196
Python
.py
205
38.156098
158
0.59021
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,588
status.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/status.py
from middlewared.service import accepts, Service class ISCSIGlobalService(Service): class Config: namespace = 'iscsi.global' cli_namespace = 'sharing.iscsi.global' @accepts(roles=['SHARING_ISCSI_GLOBAL_READ']) async def client_count(self): """ Return currently connected c...
447
Python
.py
11
33.818182
100
0.689815
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,589
auth.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/auth.py
import middlewared.sqlalchemy as sa from middlewared.api import api_method from middlewared.api.current import (IscsiAuthCreateArgs, IscsiAuthCreateResult, IscsiAuthDeleteArgs, IscsiAuthDeleteResult, IscsiAuthEntry, IscsiAuthUpdateArgs, IscsiAuthUpdateResult) from middlewared.servic...
7,073
Python
.py
145
38.57931
148
0.619939
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,590
utils.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/utils.py
import bidict AUTHMETHOD_LEGACY_MAP = bidict.bidict({ 'None': 'NONE', 'CHAP': 'CHAP', 'CHAP Mutual': 'CHAP_MUTUAL', }) # Currently SCST has this limit (scst_vdisk_dev->name) MAX_EXTENT_NAME_LEN = 64
214
Python
.py
8
23.875
54
0.679803
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,591
host_injection.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/host_injection.py
import asyncio from collections import namedtuple from ipaddress import ip_address import os from middlewared.service import Service CollectedHost = namedtuple("CollectedHost", ["ip", "iqn"]) class iSCSIHostsInjectionService(Service): class Config: namespace = "iscsi.host.injection" private = Tr...
3,472
Python
.py
84
27.52381
110
0.549049
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,592
host_crud.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/host_crud.py
import asyncio from collections import defaultdict import errno from sqlalchemy.exc import IntegrityError from middlewared.schema import accepts, Bool, Dict, IPAddr, Int, List, Patch, Ref, Str from middlewared.service import CRUDService, private, ValidationErrors import middlewared.sqlalchemy as sa LOCK = asyncio.Loc...
7,073
Python
.py
187
27.737968
124
0.56859
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,593
host_target.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/host_target.py
from collections import defaultdict from middlewared.schema import accepts, Int from middlewared.service import private, Service, ServiceChangeMixin import middlewared.sqlalchemy as sa class iSCSIHostTargetModel(sa.Model): __tablename__ = "services_iscsihosttarget" id = sa.Column(sa.Integer(), primary_key=T...
2,371
Python
.py
51
38.137255
144
0.61845
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,594
discovery_auth.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/discovery_auth.py
import middlewared.sqlalchemy as sa from middlewared.alert.source.discovery_auth import UPGRADE_ALERTS from middlewared.schema import accepts, Dict, Int, Patch, Str from middlewared.service import CRUDService, private, ValidationErrors from middlewared.validators import Range def _auth_summary(data): authmethod ...
10,425
Python
.py
209
39.363636
129
0.618893
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,595
portal.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/portal.py
import errno import middlewared.sqlalchemy as sa from middlewared.schema import accepts, Dict, Int, IPAddr, List, Patch, Str from middlewared.service import CRUDService, private, ValidationErrors from .utils import AUTHMETHOD_LEGACY_MAP def portal_summary(data): """Select a human-readable string representing t...
12,407
Python
.py
262
35.973282
115
0.574864
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,596
fs_attachment_delegate.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/fs_attachment_delegate.py
from middlewared.common.attachment import LockableFSAttachmentDelegate from .extents import iSCSITargetExtentService class ISCSIFSAttachmentDelegate(LockableFSAttachmentDelegate): name = 'iscsi' title = 'iSCSI Extent' service = 'iscsitarget' service_class = iSCSITargetExtentService async def get...
1,712
Python
.py
28
52.857143
114
0.704545
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,597
portal_listen_delegate.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/portal_listen_delegate.py
from middlewared.common.listen import ListenDelegate from middlewared.service import ServiceChangeMixin class ISCSIPortalListenDelegate(ListenDelegate, ServiceChangeMixin): def __init__(self, middleware): self.middleware = middleware async def get_listen_state(self, ips): return await self.mi...
1,489
Python
.py
32
37.5625
120
0.635546
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,598
alua.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/alua.py
import asyncio import itertools from middlewared.service import CallError, Service, job from middlewared.utils import run CHUNK_SIZE = 20 RETRY_SECONDS = 5 SLOW_RETRY_SECONDS = 30 HA_TARGET_SETTLE_SECONDS = 10 GET_UNIT_STATE_SECONDS = 2 RELOAD_REMOTE_QUICK_RETRIES = 10 STANDBY_ENABLE_DEVICES_RETRIES = 10 REMOTE_RELOA...
34,336
Python
.py
601
42.823627
145
0.593355
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)
24,599
port_attachments.py
truenas_middleware/src/middlewared/middlewared/plugins/iscsi_/port_attachments.py
from middlewared.common.ports import ServicePortDelegate class ISCSIGlobalServicePortDelegate(ServicePortDelegate): name = 'iSCSI' namespace = 'iscsi.global' port_fields = ['listen_port'] title = 'iSCSI Service' async def setup(middleware): await middleware.call('port.register_attachment_delega...
369
Python
.py
8
42
106
0.794944
truenas/middleware
2,277
481
13
LGPL-3.0
9/5/2024, 5:13:34 PM (Europe/Amsterdam)