@fiss_cmd<EOL>def attr_copy(args):
if not args.to_workspace:<EOL><INDENT>args.to_workspace = args.workspace<EOL><DEDENT>if not args.to_project:<EOL><INDENT>args.to_project = args.project<EOL><DEDENT>if (args.project == args.to_project<EOL>and args.workspace == args.to_workspace):<EOL><INDENT>eprint("<STR_LIT>"<EOL>"<STR_LIT>")<EOL>return <NUM_LIT:1><EOL><DEDENT>r = fapi.get_workspace(args.project, args.workspace)<EOL>fapi._check_response_code(r, <NUM_LIT:200>)<EOL>workspace_attrs = r.json()['<STR_LIT>']['<STR_LIT>']<EOL>if args.attributes:<EOL><INDENT>workspace_attrs = {k:v for k, v in iteritems(workspace_attrs)<EOL>if k in args.attributes}<EOL><DEDENT>if len(workspace_attrs) == <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>".format(<EOL>args.project, args.workspace))<EOL>return <NUM_LIT:1><EOL><DEDENT>message = "<STR_LIT>"<EOL>message = message.format(args.to_project, args.to_workspace)<EOL>for k, v in sorted(iteritems(workspace_attrs)):<EOL><INDENT>message += '<STR_LIT>'.format(k, v)<EOL><DEDENT>if not args.yes and not _confirm_prompt(message):<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>updates = [fapi._attr_set(k,v) for k,v in iteritems(workspace_attrs)]<EOL>r = fapi.update_workspace_attributes(args.to_project, args.to_workspace,<EOL>updates)<EOL>fapi._check_response_code(r, <NUM_LIT:200>)<EOL>return <NUM_LIT:0><EOL>
Copy workspace attributes between workspaces.