# Copyright (C) 2019-2020 Gonéri Le Bouder # # This file is part of cloud-init. See LICENSE file for license information. import logging import os import cloudinit.distros.netbsd from cloudinit import subp, util LOG = logging.getLogger(__name__) class Distro(cloudinit.distros.netbsd.NetBSD): hostname_conf_fn = "/etc/myname" init_cmd = ["rcctl"] def _read_hostname(self, filename, default=None): return util.load_file(self.hostname_conf_fn) def _write_hostname(self, hostname, filename): content = hostname + "\n" util.write_file(self.hostname_conf_fn, content) def _get_add_member_to_group_cmd(self, member_name, group_name): return ["usermod", "-G", group_name, member_name] @classmethod def manage_service(cls, action: str, service: str, *extra_args, rcs=None): """ Perform the requested action on a service. This handles OpenBSD's 'rcctl'. May raise ProcessExecutionError """ init_cmd = cls.init_cmd cmds = { "stop": ["stop", service], "start": ["start", service], "enable": ["enable", service], "disable": ["disable", service], "restart": ["restart", service], "reload": ["restart", service], "try-reload": ["restart", service], "status": ["check", service], } cmd = list(init_cmd) + list(cmds[action]) return subp.subp(cmd, capture=True, rcs=rcs) def lock_passwd(self, name): try: subp.subp(["usermod", "-p", "*", name]) except Exception: util.logexc(LOG, "Failed to lock user %s", name) raise def unlock_passwd(self, name): pass def _get_pkg_cmd_environ(self): """Return env vars used in OpenBSD package_command operations""" e = os.environ.copy() return e
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
package_management | Folder | 0755 |
|
|
parsers | Folder | 0755 |
|
|
OpenCloudOS.py | File | 277 B | 0644 |
|
TencentOS.py | File | 277 B | 0644 |
|
__init__.py | File | 51.19 KB | 0644 |
|
almalinux.py | File | 151 B | 0644 |
|
alpine.py | File | 8.38 KB | 0644 |
|
amazon.py | File | 592 B | 0644 |
|
arch.py | File | 8.51 KB | 0644 |
|
bsd.py | File | 5.08 KB | 0644 |
|
bsd_utils.py | File | 1.4 KB | 0644 |
|
centos.py | File | 151 B | 0644 |
|
cloudlinux.py | File | 151 B | 0644 |
|
cos.py | File | 247 B | 0644 |
|
debian.py | File | 9.84 KB | 0644 |
|
dragonflybsd.py | File | 230 B | 0644 |
|
eurolinux.py | File | 151 B | 0644 |
|
fedora.py | File | 437 B | 0644 |
|
freebsd.py | File | 7.45 KB | 0644 |
|
gentoo.py | File | 9.11 KB | 0644 |
|
mariner.py | File | 1.65 KB | 0644 |
|
miraclelinux.py | File | 151 B | 0644 |
|
net_util.py | File | 6.4 KB | 0644 |
|
netbsd.py | File | 4.78 KB | 0644 |
|
networking.py | File | 10.75 KB | 0644 |
|
openbsd.py | File | 1.87 KB | 0644 |
|
openeuler.py | File | 275 B | 0644 |
|
openmandriva.py | File | 237 B | 0644 |
|
opensuse-leap.py | File | 247 B | 0644 |
|
opensuse-microos.py | File | 247 B | 0644 |
|
opensuse-tumbleweed.py | File | 247 B | 0644 |
|
opensuse.py | File | 9.85 KB | 0644 |
|
photon.py | File | 5.18 KB | 0644 |
|
rhel.py | File | 7.5 KB | 0644 |
|
rhel_util.py | File | 1.4 KB | 0644 |
|
rocky.py | File | 151 B | 0644 |
|
sle-micro.py | File | 247 B | 0644 |
|
sle_hpc.py | File | 247 B | 0644 |
|
sles.py | File | 247 B | 0644 |
|
suse.py | File | 81 B | 0644 |
|
ubuntu.py | File | 1.75 KB | 0644 |
|
ug_util.py | File | 9.75 KB | 0644 |
|
virtuozzo.py | File | 151 B | 0644 |
|