Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
 
Answered
Adding data to vault on installation

I have tried adding a secret to the vault from DbPlan, but it isn't working.


class DbPlan(MarketplaceDbPlan):
    # pylint: disable=useless-super-delegation

    def __init__(self):
        super().__init__()
        self.ui_text_prefix = "roy_uux"  # Will be used for all self.ui_text_elements

        self.vault_info = [vault_info.VaultInfo("key_prefix", "key_basename", {"hmac_secret": secrets.token_hex()}, allow_editable=False)]

This is the error I get when I run q2 run_db_plan.

Traceback (most recent call last):
  File "/home/roy/boost-stack/q2/q2-venv/bin/q2", line 8, in <module>
    sys.exit(main())
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/q2_sdk/core/q2.py", line 36, in main
    entrypoint_runner.execute()
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/q2_sdk/core/cli/entrypoint_runner.py", line 168, in execute
    LOOP.run_until_complete(handle_coro)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/q2_sdk/entrypoints/run_db_plan.py", line 61, in handle
    await run_db_plan(self.logger, db_plan, self.hq_credentials, form_name, form_id=form_id)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/q2_sdk/entrypoints/run_db_plan.py", line 69, in run_db_plan
    await db_plan.install(logger, hq_credentials, form_name, form_id=form_id)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/q2_marketplace/models/db_plan.py", line 29, in install
    await super().install(logger, hq_credentials, form_name)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/q2_sdk/core/install_steps/db_plan.py", line 198, in install
    await item.install()
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/q2_sdk/core/install_steps/vault_info.py", line 95, in install
    self.q2_vault_obj.client.write(
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/hvac/v1/__init__.py", line 231, in write
    return self._adapter.post('/v1/{0}'.format(path), json=kwargs, wrap_ttl=wrap_ttl)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/hvac/adapters.py", line 107, in post
    return self.request('post', url, **kwargs)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/hvac/adapters.py", line 342, in request
    response = super(JSONAdapter, self).request(*args, **kwargs)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/hvac/adapters.py", line 287, in request
    response = self.session.request(
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/requests/sessions.py", line 515, in request
    prep = self.prepare_request(req)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/requests/sessions.py", line 443, in prepare_request
    p.prepare(
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/requests/models.py", line 318, in prepare
    self.prepare_url(url, params)
  File "/home/roy/boost-stack/q2/q2-venv/lib/python3.9/site-packages/requests/models.py", line 392, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL 'localhost/v1/key_prefix/key_basename': No scheme supplied. Perhaps you meant http://localhost/v1/key_prefix/key_basename?
Posted 4 years ago
Votes Newest

Answers 2


Roy,

Great job discovering that install step! It's not often used, so it's possible we haven't seen it used by an external dev before on a local install and there's a bug. I'm guessing this is installed on your machine, either using WSL or a linux host since I don't see that path on the shared dev machine? With that information we can try to reproduce and patch it.

Brian

Posted 4 years ago
Brian Mego
45 × 1 Administrator
0

I got the error message while developing locally on a Linux machine.

— Roy Olav Purser   4 years ago
0

Great, will look into it. In the meanwhile, you can seed that data with the q2 vault CLI command. The caliper_admin script (which you probably ran to get set up) sets some environment variables. It should have set Q2SDK_VAULT_LOCAL_DIR=~/.vaultdir or something along those lines. When you type q2 vault add it should prompt you for some data, which will eventually go into that configured dir, simulating vault on your local filesystem.

— Brian Mego   4 years ago