Skip to content

Commit

Permalink
[FIX] deployment command
Browse files Browse the repository at this point in the history
  • Loading branch information
katyukha committed Sep 15, 2024
1 parent 0edc5b8 commit 4c30664
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions subpackages/lib/source/odood/lib/deploy/utils.d
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module odood.lib.deploy.utils;

private import std.logger: infof;
private import std.logger: infof, tracef;
private import std.format: format;
private import std.exception: enforce, errnoEnforce;
private import std.conv: to, text;
private import std.string: strip;

private import core.sys.posix.unistd: geteuid, getegid;
private import core.sys.posix.pwd: getpwnam_r, passwd;
Expand Down Expand Up @@ -47,15 +48,15 @@ void createSystemUser(in Path home, in string name) {
bool postgresCheckUserExists(in string username) {
auto output = Process("psql")
.setArgs([
"-c",
"-t", "-A", "-c",
i"SELECT count(*) FROM pg_user WHERE usename = '$(username)';".text,
])
.withUser("postgres")
.execute
.ensureOk(true)
.output;
.output.strip;

return output.to!int == 0;
return output.to!int != 0;
}


Expand All @@ -70,7 +71,7 @@ void postgresCreateUser(in string username, in string password) {
])
.withUser("postgres")
.execute
.ensureStatus(true);
.ensureOk(true);
infof("Postgresql user '%s' for Odoo created successfully.", username);
}

Expand Down

0 comments on commit 4c30664

Please sign in to comment.