daemon: changes usage of running scripts using /bin/sh to bash to help provide consistency in what could be ran, added bash as a dependency in installation scripts, added bash as an executable check during startup
This commit is contained in:
parent
eb70386238
commit
0d2dd70727
20 changed files with 71 additions and 62 deletions
|
@ -599,7 +599,7 @@ class CoreNode(CoreNodeBase):
|
|||
if self.server is None:
|
||||
return self.client.check_cmd(args, wait=wait, shell=shell)
|
||||
else:
|
||||
args = self.client.create_cmd(args)
|
||||
args = self.client.create_cmd(args, shell)
|
||||
return self.server.remote_cmd(args, wait=wait)
|
||||
|
||||
def termcmdstring(self, sh: str = "/bin/sh") -> str:
|
||||
|
|
|
@ -5,7 +5,7 @@ The control channel can be accessed via calls using the vcmd shell.
|
|||
"""
|
||||
|
||||
from core import utils
|
||||
from core.executables import VCMD
|
||||
from core.executables import BASH, VCMD
|
||||
|
||||
|
||||
class VnodeClient:
|
||||
|
@ -49,7 +49,9 @@ class VnodeClient:
|
|||
"""
|
||||
pass
|
||||
|
||||
def create_cmd(self, args: str) -> str:
|
||||
def create_cmd(self, args: str, shell: bool = False) -> str:
|
||||
if shell:
|
||||
args = f'{BASH} -c "{args}"'
|
||||
return f"{VCMD} -c {self.ctrlchnlname} -- {args}"
|
||||
|
||||
def check_cmd(self, args: str, wait: bool = True, shell: bool = False) -> str:
|
||||
|
@ -63,5 +65,5 @@ class VnodeClient:
|
|||
:raises core.CoreCommandError: when there is a non-zero exit status
|
||||
"""
|
||||
self._verify_connection()
|
||||
args = self.create_cmd(args)
|
||||
args = self.create_cmd(args, shell)
|
||||
return utils.cmd(args, wait=wait, shell=shell)
|
||||
|
|
|
@ -383,12 +383,12 @@ class Veth(CoreInterface):
|
|||
try:
|
||||
self.node.node_net_client.device_flush(self.name)
|
||||
except CoreCommandError:
|
||||
logging.exception("error shutting down interface")
|
||||
pass
|
||||
if self.localname:
|
||||
try:
|
||||
self.net_client.delete_device(self.localname)
|
||||
except CoreCommandError:
|
||||
logging.info("link already removed: %s", self.localname)
|
||||
pass
|
||||
self.up = False
|
||||
|
||||
|
||||
|
|
|
@ -121,11 +121,7 @@ class LinuxNetClient:
|
|||
:param device: device to flush
|
||||
:return: nothing
|
||||
"""
|
||||
self.run(
|
||||
f"[ -e /sys/class/net/{device} ] && "
|
||||
f"{IP} address flush dev {device} || true",
|
||||
shell=True,
|
||||
)
|
||||
self.run(f"{IP} address flush dev {device}")
|
||||
|
||||
def device_mac(self, device: str, mac: str) -> None:
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue