Skip to content

Commit

Permalink
Merge pull request #31 from plesk/support-version-after-finish
Browse files Browse the repository at this point in the history
Support --version parameter after conversion is done
  • Loading branch information
SandakovMM authored Apr 26, 2024
2 parents c9f64b5 + 35b0537 commit d58b275
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions pleskdistup/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,21 @@ def main():
log.debug(f"Looking for upgrader by the name '{options.upgrader_name}'")
upgraders = list(pleskdistup.registry.iter_upgraders(upgrader_name=options.upgrader_name))
log.debug(f"Found upgraders: {upgraders}")

if options.version:
if not upgraders:
upgraders = list(pleskdistup.registry.iter_upgraders())
if len(upgraders) != 1:
printerr(f"Couldn't get upgrader name. Please provide upgrader name by --upgrader-name. Available upgraders: {upgraders}")
return 1

upgrader = upgraders[0].create_upgrader()
print(
f"Plesk dist-upgrader {pleskdistup.config.revision}.\n"
f"{upgrader.upgrader_name} {upgrader.upgrader_version}."
)
return 0

if not upgraders:
printerr(f"No upgraders found for your system ({distro})")
return 1
Expand Down Expand Up @@ -483,12 +498,7 @@ def main():
)
upgrader.parse_args(["--help"])
parser.exit()
if options.version:
print(
f"Plesk dist-upgrader {pleskdistup.config.revision}.\n"
f"{upgrader.upgrader_name} {upgrader.upgrader_version}."
)
return 0

upgrader.parse_args(extra_args)

if options.prepare_feedback:
Expand Down

0 comments on commit d58b275

Please sign in to comment.