Skip to content

Commit

Permalink
Take AWS region from AWS_DEFAULT_REGION into qhub-config.yaml on init…
Browse files Browse the repository at this point in the history
…, but otherwise always respect the setting in qhub-config.yaml (#950)
  • Loading branch information
danlester authored Dec 1, 2021
1 parent a5d0190 commit cf46ab1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ repos:
rev: v2.3.0
hooks:
- id: check-yaml
exclude: 'qhub/template/\{\{ cookiecutter\.repo_directory \}\}/\.github/.*'
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
Expand Down
2 changes: 2 additions & 0 deletions qhub/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ def render_config(
config["amazon_web_services"] = AMAZON_WEB_SERVICES
if kubernetes_version:
config["amazon_web_services"]["kubernetes_version"] = kubernetes_version
if "AWS_DEFAULT_REGION" in os.environ:
config["amazon_web_services"]["region"] = os.environ["AWS_DEFAULT_REGION"]
elif cloud_provider == "local":
config["theme"]["jupyterhub"][
"hub_subtitle"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_DEFAULT_REGION: ${{ cookiecutter.amazon_web_services.region }}
{% endraw %}
{% elif cookiecutter.provider == 'do' %}
{% raw %}
Expand Down
6 changes: 3 additions & 3 deletions scripts/aws-force-destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ def force_destroy_configuration(config):
for ni in subnet.network_interfaces.all():
ni.load()
# But can only detach if attached...
ni.detach(DryRun=False, Force=True)

ni.delete()
if ni.attachment:
ni.detach(DryRun=False, Force=True)
ni.delete()

logging.info(f"Delete subnet {r['resource']}")
subnet.delete(DryRun=False)
Expand Down

0 comments on commit cf46ab1

Please sign in to comment.