Skip to content

Commit

Permalink
Added Remote-list command line option
Browse files Browse the repository at this point in the history
  • Loading branch information
nirlipo committed May 25, 2022
1 parent 30a8426 commit 70b49bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions planutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def main():
parser_remote.add_argument('package', help='package name')
parser_remote.add_argument('options', help='commandline options for the package', nargs="*")

parser_remote_list = subparsers.add_parser('remote-list', help='list the available remote packages')


parser_checkinstalled = subparsers.add_parser('check-installed', help='check if a package is installed')
parser_checkinstalled.add_argument('package', help='package name')

Expand Down Expand Up @@ -124,6 +127,10 @@ def main():
from planutils.package_installation import remote
remote(args.package, args.options)

elif 'remote-list' == args.command:
from planutils.package_installation import package_remote_list
package_remote_list()

elif 'list' == args.command:
from planutils.package_installation import package_list
package_list()
Expand Down
10 changes: 10 additions & 0 deletions planutils/package_installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ def run(target, options):
sys.exit(f"Package {target} is not executable")
subprocess.run([Path(settings.PLANUTILS_PREFIX) / "packages" / target / "run"] + options)

def package_remote_list():

package_url = settings.PAAS_SERVER + "/package"
r = requests.get(package_url)
remote_packages = r.json()

print("\nDeployed:")
for p in remote_packages:
arguments = " ".join(f'{{{a["name"]}}} ' for a in p['endpoint']['services']['solve']['args'])
print(" %s: %s\n\tArguments: %s" % (p['package_name'], p['name'], arguments ))

def remote(target, options):

Expand Down

0 comments on commit 70b49bd

Please sign in to comment.