Skip to content

v2: Add ParseOption type to made clouds.Parse() more usable for optional With* funcs#2914

Merged
pierreprinetti merged 2 commits intogophercloud:masterfrom
sardinasystems:ss-fix-default-clouds-location
Feb 13, 2024
Merged

v2: Add ParseOption type to made clouds.Parse() more usable for optional With* funcs#2914
pierreprinetti merged 2 commits intogophercloud:masterfrom
sardinasystems:ss-fix-default-clouds-location

Conversation

@vooon
Copy link
Copy Markdown
Contributor

@vooon vooon commented Feb 13, 2024

So that makes easier to have conditional With like that:

https://github.com/sardinasystems/fleeting-plugin-openstack/blob/90c744fc9ee23d8a18dad96f2a677a9d1a54222c/provider.go#L44-L52

Fixes #2913

In addition it fixes search for default /etc/openstack/clouds.yaml file.

That fix following error returned by Parse():
```
Failed to parse clouds.yaml: yaml: input error: read /etc/openstack: is a directory
```

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Fix gophercloud#2913

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting your first PR! Be sure that we will be looking at it but keep in mind
this sometimes takes a while.
Please let the maintainers know if your PR has not got enough attention after a few days.
If any doubt, please consult our PR tutorial.

@github-actions github-actions bot added the semver:minor Backwards-compatible change label Feb 13, 2024
@vooon vooon changed the title v2: Add ParseOption type to mage clouds.Parse() more usable for optional With* funcs v2: Add ParseOption type to made clouds.Parse() more usable for optional With* funcs Feb 13, 2024
@pierreprinetti
Copy link
Copy Markdown
Member

pierreprinetti commented Feb 13, 2024

I understand that it can be useful to conditionally add functional options, and indeed I can't find a straightforward way of allowing that without exposing the options type. Thank you @vooon for your contribution.

@pierreprinetti pierreprinetti self-assigned this Feb 13, 2024
@pierreprinetti pierreprinetti added the backport-v1 This PR will be backported to v1 label Feb 13, 2024
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 77.233%. remained the same
when pulling 5d62d9c on sardinasystems:ss-fix-default-clouds-location
into c287220 on gophercloud:master.

@vooon
Copy link
Copy Markdown
Contributor Author

vooon commented Feb 13, 2024

@pierreprinetti that's quite common way doing With*, for example grpc.DialOption

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v1 This PR will be backported to v1 semver:minor Backwards-compatible change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v2: Export a slice of clouds config opts

4 participants