в чем разница? async function createDeleteGroup(agent: AgentList): Promise<string> {…
- User
в чем разница? async function createDeleteGroup(agent: AgentList): Promise { const group = genereteString(); const cmdCreate =
sudo groupadd ${group}; const cmdDelete =sudo groupdel ${group};await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdCreate); await OperationRepeater.RepeatUntil( async () => (await sshService.execCommandKey(agent.ip, Project.Rpoint, 'getent group')).stdout.includes(group) === true, 10, 1, ); await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdDelete);
return group; }
и async function createDeleteGroup(agent: AgentList): Promise { const group = genereteString(); const cmdCreate =
sudo groupadd ${group}; const cmdDelete =sudo groupdel ${group};await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdCreate); await OperationRepeater.RepeatUntil( async () => (await sshService.execCommandKey(agent.ip, Project.Rpoint, 'getent group')).stdout.includes(group) === true, 10, 1, ); await sshService.execCommandKey(agent.ip, Project.Rpoint,
sudo usermod -a -G ${group} ${Project.Rpoint}); await sshService.execCommandKey(agent.ip, Project.Rpoint,sudo gpasswd -d ${Project.Rpoint} ${group});await sshService.execCommandKey(agent.ip, Project.Rpoint, cmdDelete);
return group; }
что означает await sshService.execCommandKey(agent.ip, Project.Rpoint,
sudo usermod -a -G ${group} ${Project.Rpoint}); await sshService.execCommandKey(agent.ip, Project.Rpoint,sudo gpasswd -d ${Project.Rpoint} ${group}); - Assistant
Эти две строчки добавляют и удаляют пользователя
Project.Rpointиз группы${group}соответственно.sudo usermod -a -Gдобавляет пользователя в группу,-aуказывает на добавление,-Gуказывает на группу, к которой нужно добавить пользователя.sudo gpasswd -dудаляет пользователя из группы,-dуказывает на удаление, аProject.Rpointи${group}указывают на пользователя и группу, из которой нужно удалить пользователя.