Skip to content

Commit

Permalink
v0.16.19 (#113)
Browse files Browse the repository at this point in the history
* Added config_diff HL command.
* HL command mop updated to work in Python 3 and fail with proper error message when workspace bucket is inaccessible (fixes #111).
  • Loading branch information
dheiman authored Nov 19, 2018
1 parent e047867 commit 22045bf
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ Change Log for FISSFC: the (Fi)recloud (S)ervice (S)elector
=======================================================================
Terms used below: HL = high level interface, LL = low level interface

v0.16.19 - Added config_diff HL command, HL command mop updated to work in
Python 3 and fail with proper error message when workspace bucket is
inaccessible.

v0.16.18 - Added HL export commands for sample, pair and participant sets.

v0.16.17 - HL pair_list and participant_list cmds now operate on containers,
as done for sample_list in previous release; with pair_list
supporting pair, pair_set, participant and workspace; and
participant_list supporting participant, participant_set,
and workspace; extended HL tests accordingly

v0.16.16 - Added pair_list HL command; enlarged scope of applicability of
sample_list, to not only workspaces but all sample container
types: pair, sample_set, workspace, participant; added pair_list
Expand Down
2 changes: 1 addition & 1 deletion firecloud/__about__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Package version
__version__ = "0.16.18"
__version__ = "0.16.19"
43 changes: 41 additions & 2 deletions firecloud/fiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import subprocess
import re
import collections
from difflib import unified_diff
from six import iteritems, string_types, itervalues, u, text_type
from six.moves import input
from firecloud import api as fapi
Expand Down Expand Up @@ -564,6 +565,27 @@ def config_get(args):
return json.dumps(r.json(), indent=4, separators=(',', ': '),
sort_keys=True, ensure_ascii=False)

@fiss_cmd
def config_diff(args):
"""Compare method configuration definitions across workspaces. Ignores
methodConfigVersion if the verbose argument is not set"""
config_1 = config_get(args).splitlines()
args.project = args.Project
args.workspace = args.Workspace
cfg_1_name = args.config
if args.Config is not None:
args.config = args.Config
if args.Namespace is not None:
args.namespace = args.Namespace
config_2 = config_get(args).splitlines()
if not args.verbose:
config_1 = skip_cfg_ver(config_1)
config_2 = skip_cfg_ver(config_2)
return list(unified_diff(config_1, config_2, cfg_1_name, args.config, lineterm=''))

def skip_cfg_ver(cfg):
return [line for line in cfg if not line.startswith(' "methodConfigVersion": ')]

@fiss_cmd
def config_put(args):
'''Install a valid method configuration into a workspace, in one of several
Expand Down Expand Up @@ -1081,7 +1103,7 @@ def mop(args):
bucket_files = bucket_files.decode()

except subprocess.CalledProcessError as e:
eprint("Error retrieving files from bucket: " + e)
eprint("Error retrieving files from bucket: " + str(e))
return 1

bucket_files = set(bucket_files.strip().split('\n'))
Expand Down Expand Up @@ -1157,8 +1179,10 @@ def can_delete(f):
print("Deleting files with gsutil...")
gsrm_proc = subprocess.Popen(gsrm_args, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
# Pipe the deleteable_files into gsutil
result = gsrm_proc.communicate(input='\n'.join(deleteable_files))[0]
result = gsrm_proc.communicate(input='\n'.join(deleteable_files).encode())[0]
if args.verbose:
if type(result) == bytes:
result = result.decode()
print(result.rstrip())
return 0

Expand Down Expand Up @@ -2077,6 +2101,21 @@ def main(argv=None):
subp.add_argument('-p', '--project', default=fcconfig.project,
help=proj_help, required=proj_required)
subp.set_defaults(func=config_get)

subp = subparsers.add_parser('config_diff',
description='Compare method configuration definitions across workspaces',
parents=[conf_parent])
subp.add_argument('-w', '--workspace', help='First Workspace name',
default=fcconfig.workspace, required=workspace_required)
subp.add_argument('-p', '--project', default=fcconfig.project,
help="First " + proj_help, required=proj_required)
subp.add_argument('-C', '--Config', help="Second method config name")
subp.add_argument('-N', '--Namespace', help="Second method config namespace")
subp.add_argument('-W', '--Workspace', help='Second Workspace name',
default=fcconfig.workspace, required=workspace_required)
subp.add_argument('-P', '--Project', default=fcconfig.project,
help="Second " + proj_help, required=proj_required)
subp.set_defaults(func=config_diff)

subp = subparsers.add_parser('config_copy', description=
'Copy a method config to a new name/space/namespace/project, ' +
Expand Down

0 comments on commit 22045bf

Please sign in to comment.