question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Harness to auto attach storage?

See original GitHub issue

Following up on https://github.com/canonical/operator/pull/734, I tried it out in some unit tests and had the following recurring code:

storage_id = self.harness.add_storage("name")[0]
self.harness.attach_storage(storage_id)

Would it be feasible/sensible to auto attach all storages in metadata (perhaps with count=1 by default)?

For example,

self.harness.auto_attach_storages()
self.harness.begin_with_initial_hooks()

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
rwcarlsencommented, May 26, 2022

The trick with auto-attaching on begin_with_initial_hooks is the harness doesn’t know how many instances of each particular storage it should create/mount for cases where there can be multiple. If we did do that, we’d need to implement some logic mirroring how juju decides. And also we’d have to think carefully about how to deal with cases where we a charm dev has manually attached some storage prior to calling begin_with_initial_hooks. My inclination right now is to just leave it as is require devs to explicitly add storage for their tests.

0reactions
rwcarlsencommented, May 6, 2022
  1. The -/_ replacement occurs automatically with the .on[...] call: https://github.com/canonical/operator/blob/eb33286800bf94b60b7354b350f2725ab5b81865/ops/framework.py#L453
  2. I’ll need to look into this more. At first glance, it seems like we should definitely use more care with how we handle add/attach/detach - it looks like there may be a few subtle bugs lurking.
  3. Possibly. I’ll dig into this as well.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Harness Delegate FAQs - Harness.io Docs
Delegates connect to the Harness Manager and are tested for connectivity to resources and tasks. Harness Cloud Providers and Connectors ...
Read more >
Amazon.com : DYKESON Pet Barrier Dog Car Net ...
DYKESON Pet Barrier Dog Car Net Barrier with Auto Safety Mesh Organizer Baby Stretchable Storage Bag Universal for Cars, SUVs -Easy Install,Safer to...
Read more >
3M™ Protecta® Comfort Construction Positioning Harness ...
3M™ Protecta® P200 Safety Harness is designed to help provide industrial workers with ... simple attachment of personal self-retracting lifelines (pSRLs).
Read more >
Where/How to Store Your Trailer Wiring Harness - YouTube
Where should you leave your trailer wiring? Does is hang underneath your bumper? Is it just looped around your hitch?
Read more >
Auto attach VirtualDisk on Storage Pool after reboot ... - Console
Auto attach VirtualDisk on Storage Pool after reboot on Windows Server 2016. Reboot to confirm if StorageSpace VirtualDisk re-attaches correctly.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found