Skip to content

Easily resolve HAB_FREEZE when inside of that config#123

Draft
MHendricks wants to merge 1 commit into
mainfrom
mikeh/resovle_from_env
Draft

Easily resolve HAB_FREEZE when inside of that config#123
MHendricks wants to merge 1 commit into
mainfrom
mikeh/resovle_from_env

Conversation

@MHendricks

Copy link
Copy Markdown
Member

This allows you to easily get a hab Config object for the hab config you are currently running inside of.

Currently you have to run this code:

import os
import hab

default_uri = "a/uri"
freeze = os.getenv('HAB_FREEZE')
uri = os.getenv('HAB_URI', default_uri)
resolver = hab.Resolver.instance()
if freeze:
    cfg = hab.parsers.UnfrozenConfig(freeze, resolver)
else:
    cfg = resolver.resolve(uri)

This Pull Request allows you to replace that code with.

resolver = hab.Resolver.instance()
cfg = resolver.resolve("a/uri", from_env=True)

Checklist

  • I have read the CONTRIBUTING.md document
  • I formatted my changes with black
  • I linted my changes with flake8
  • I have added documentation regarding my changes where necessary
  • Any pre-existing tests continue to pass
  • Additional tests were made covering my changes

Types of Changes

  • Bugfix (change that fixes an issue)
  • New Feature (change that adds functionality)
  • Documentation Update (if none of the other choices apply)

Proposed Changes

This allows you to easily get a hab Config object for the hab config you
are currently running inside of.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant