This commit is contained in:
Muayyad alsadi 2022-03-12 23:17:26 +03:00
parent 9e3020a9df
commit 0b469e0590

View File

@ -1316,7 +1316,9 @@ class PodmanCompose:
sys.exit(1) sys.exit(1)
log("using podman version: " + self.podman_version) log("using podman version: " + self.podman_version)
cmd_name = args.command cmd_name = args.command
compose_required = cmd_name != "version" and (cmd_name != "systemd" or args.action!="create-unit") compose_required = cmd_name != "version" and (
cmd_name != "systemd" or args.action != "create-unit"
)
if compose_required: if compose_required:
self._parse_compose_file() self._parse_compose_file()
cmd = self.commands[cmd_name] cmd = self.commands[cmd_name]
@ -1718,8 +1720,10 @@ def compose_systemd(compose, args):
if k.startswith("COMPOSE_") or k.startswith("PODMAN_"): if k.startswith("COMPOSE_") or k.startswith("PODMAN_"):
f.write(f"{k}={v}\n") f.write(f"{k}={v}\n")
print(f"writing [{fn}]: done.") print(f"writing [{fn}]: done.")
print(f"""later you can use use enable, start, stop, status, cat print(
like this `systemctl --user enable --now podman-compose@{proj_name}`""") f"""later you can use use enable, start, stop, status, cat
like this `systemctl --user enable --now podman-compose@{proj_name}`"""
)
elif args.action == "create-unit": elif args.action == "create-unit":
script = os.path.realpath(sys.argv[0]) script = os.path.realpath(sys.argv[0])
fn = "/usr/lib/systemd/user/podman-compose@.service" fn = "/usr/lib/systemd/user/podman-compose@.service"
@ -1745,9 +1749,11 @@ WantedBy=default.target
with open(fn, "w") as f: with open(fn, "w") as f:
f.write(out) f.write(out)
print(f"writing [{fn}]: done.") print(f"writing [{fn}]: done.")
print(""" print(
"""
while in your project type `podman-compose systemd -a register` while in your project type `podman-compose systemd -a register`
""") """
)
else: else:
print(out) print(out)
log(f"Could not write to [{fn}], use 'sudo'") log(f"Could not write to [{fn}], use 'sudo'")
@ -2498,6 +2504,7 @@ def compose_logs_parse(parser):
"services", metavar="services", nargs="*", default=None, help="service names" "services", metavar="services", nargs="*", default=None, help="service names"
) )
@cmd_parse(podman_compose, "systemd") @cmd_parse(podman_compose, "systemd")
def compose_systemd_parse(parser): def compose_systemd_parse(parser):
parser.add_argument( parser.add_argument(
@ -2508,6 +2515,7 @@ def compose_systemd_parse(parser):
help="create systemd unit file or register compose stack to it", help="create systemd unit file or register compose stack to it",
) )
@cmd_parse(podman_compose, "pull") @cmd_parse(podman_compose, "pull")
def compose_pull_parse(parser): def compose_pull_parse(parser):
parser.add_argument( parser.add_argument(