Skip to content

Commit

Permalink
Merge pull request #18 from hahnavi/dev
Browse files Browse the repository at this point in the history
Merge from Dev
  • Loading branch information
hahnavi authored Jan 4, 2025
2 parents 0148463 + bfac5a1 commit c63a697
Show file tree
Hide file tree
Showing 28 changed files with 1,740 additions and 1,135 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ jobs:
env:
USER_TEST: usertest
run: |
apt update && apt install -y openssh-server
apt update && apt install -y openssh-server sudo
service ssh start
mkdir ${HOME}/.ssh
ssh-keyscan -H localhost | tee -a ${HOME}/.ssh/known_hosts
ssh-keygen -t ed25519 -N "" -f ${HOME}/.ssh/id_ed25519
useradd -m -d /home/${USER_TEST} -N ${USER_TEST}
usermod -a -G sudo ${USER_TEST}
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | tee /etc/sudoers.d/sudo-nopasswd
su ${USER_TEST} -c 'mkdir /home/${USER_TEST}/.ssh'
cat ${HOME}/.ssh/id_ed25519.pub | su ${USER_TEST} -c 'tee -a /home/${USER_TEST}/.ssh/authorized_keys'
chmod 700 /home/${USER_TEST}/.ssh
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
ssh-keyscan -H localhost | tee -a ${HOME}/.ssh/known_hosts
ssh-keygen -t ed25519 -N "" -f ${HOME}/.ssh/id_ed25519
sudo useradd -m -d /home/${USER_TEST} -N ${USER_TEST}
sudo usermod -a -G sudo ${USER_TEST}
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/sudo-nopasswd
sudo -u ${USER_TEST} mkdir /home/${USER_TEST}/.ssh
cat ${HOME}/.ssh/id_ed25519.pub | sudo -u ${USER_TEST} tee -a /home/${USER_TEST}/.ssh/authorized_keys
sudo chmod 700 /home/${USER_TEST}/.ssh
Expand Down
87 changes: 34 additions & 53 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ edition = "2021"
vendored-openssl = ["http-klien/vendored-openssl", "ssh2/vendored-openssl"]

[dependencies]
anyhow = "1.0.93"
base64 = "0.22.1"
clap = { version = "4.5.21", features = ["derive"] }
anyhow = "1.0.95"
clap = { version = "4.5.23", features = ["derive"] }
http-klien = { git = "https://github.com/hahnavi/http-klien-rs", branch = "main" }
minijinja = "2.5.0"
mlua = { version = "0.10.1", features = [
mlua = { version = "0.10.2", features = [
"anyhow",
"luajit",
"macros",
Expand All @@ -25,8 +24,8 @@ rand = "0.8.5"
rayon = "1.10.0"
regex = "1.11.1"
rustyline = "15.0.0"
serde = { version = "1.0.216", features = ["derive"] }
serde_json = "1.0.133"
serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.134"
ssh2 = { version = "0.9.4" }

[dev-dependencies]
Expand Down
11 changes: 8 additions & 3 deletions examples/postgresql_replication_setup_ubuntu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ local tasks_postgresql_install = {
},
{
name = "Add PostgreSQL repository",
env = {
YES = "yes",
},
komandan.modules.cmd({
cmd = "YES=yes /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh",
cmd = "/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh",
}),
},
{
Expand Down Expand Up @@ -102,8 +105,10 @@ end
local tasks_setup_primary = {
{
name = "Create replication user",
komandan.modules.cmd({
cmd = "psql -c \"DO \\$\\$ BEGIN IF NOT EXISTS (SELECT FROM pg_catalog.pg_user WHERE usename = '" .. os.getenv("REPLICATOR_USER") .. "') THEN CREATE USER " .. os.getenv("REPLICATOR_USER") .. " WITH REPLICATION ENCRYPTED PASSWORD '" .. os.getenv("REPLICATOR_PASSWORD") .. "'; END IF; END \\$\\$;\"",
komandan.modules.postgresql_user({
name = os.getenv("REPLICATOR_USER"),
password = os.getenv("REPLICATOR_PASSWORD"),
role_attr_flags = "REPLICATION",
}),
as_user = "postgres",
},
Expand Down
4 changes: 4 additions & 0 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub struct Args {
#[arg(short = 'e')]
pub chunk: Option<String>,

/// Dry run mode
#[arg(short, long)]
pub dry_run: bool,

/// Enter interactive mode after executing 'script'.
#[arg(short, long)]
pub interactive: bool,
Expand Down
Loading

0 comments on commit c63a697

Please sign in to comment.