-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SN wrangler_utils add set_property #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add your function to the wrangler_utils
CLI, like the other functions. That might require a slight change of your function arguments.
magma_smaht/wrangler_utils.py
Outdated
def set_property( | ||
uuid: str, | ||
prop_key: str, | ||
prop_value: Union[str,int], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prop_value could also be a list. Any
is probably fine here. Validation will be done portal side anyway and it will fail if we try to patch some unexpected.
magma_smaht/wrangler_utils.py
Outdated
ff_utils.patch_metadata(patch_body, obj_id=uuid, key=smaht_key) | ||
print(f"Set item {uuid} property {prop_key} to {prop_value}.") | ||
except Exception as e: | ||
raise Exception(f"Item could not be PATCHed: {e}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need str(e)
here. This might be wrong in other places. Please correct those as well.
Actually your function args should be fine. |
@click.help_option("--help", "-h") | ||
@click.option( | ||
"-m", | ||
"--mwfr-identifier", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should -i
and --identifier
type=str, | ||
help="Name of environment in smaht-keys file", | ||
) | ||
def set_property(mwfr_identifier,property_key,property_value,auth_env): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mwfr_identifier => identifier
Adds function
set_property
towrangler_utils.py
that can patch property values by uuid.