|
| 1 | +# -*- coding: utf-8 -*- |
| 2 | +# vim: ft=sls |
| 3 | + |
| 4 | +{#- Get the `tplroot` from `tpldir` #} |
| 5 | +{%- set tplroot = tpldir.split('/')[0] %} |
| 6 | +{%- set sls_package_install = tplroot ~ '.package.install' %} |
| 7 | +{%- from tplroot ~ "/map.jinja" import mapdata as flux_cli with context %} |
| 8 | +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} |
| 9 | +{%- set install_dir = 'C:\\Program Files\\FluxCLI\\' %} |
| 10 | +
|
| 11 | +
|
| 12 | +include: |
| 13 | + - {{ sls_package_install }} |
| 14 | +
|
| 15 | +Ensure Default User kubeconfig directory exists: |
| 16 | + file.directory: |
| 17 | + - makedirs: True |
| 18 | + - name: 'C:\Users\Default\.kube' |
| 19 | + - require: |
| 20 | + - sls: {{ sls_package_install }} |
| 21 | +
|
| 22 | +Ensure Flux CLI Autocompletion in Global (default) Windows PowerShell Profile: |
| 23 | + file.blockreplace: |
| 24 | + - append_if_not_found: True |
| 25 | + - content: | |
| 26 | + if (Test-Path "{{ install_dir }}flux-completion.ps1") { |
| 27 | + . "{{ install_dir }}flux-completion.ps1" |
| 28 | + } |
| 29 | + if (Test-Path "{{ install_dir }}flux-env.ps1") { |
| 30 | + . "{{ install_dir }}flux-env.ps1" |
| 31 | + } |
| 32 | + - marker_end: '# --- END FLUX CLI AUTOLOAD ---' |
| 33 | + - marker_start: '# --- START FLUX CLI AUTOLOAD ---' |
| 34 | + - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' |
| 35 | + - require: |
| 36 | + - file: 'Ensure Global (default) Windows PowerShell Profile Exists' |
| 37 | + - cmd: 'Generate Flux CLI PowerShell Autocompletion' |
| 38 | + - file: 'Install user-env setup for Windows container runtimes' |
| 39 | +
|
| 40 | +Ensure Flux CLI Autocompletion in Global PowerShell 7 Profile: |
| 41 | + file.blockreplace: |
| 42 | + - append_if_not_found: True |
| 43 | + - content: | |
| 44 | + if (Test-Path "{{ install_dir }}flux-completion.ps1") { |
| 45 | + . "{{ install_dir }}flux-completion.ps1" |
| 46 | + } |
| 47 | + if (Test-Path "{{ install_dir }}flux-env.ps1") { |
| 48 | + . "{{ install_dir }}flux-env.ps1" |
| 49 | + } |
| 50 | + - marker_end: '# --- END FLUX CLI AUTOLOAD ---' |
| 51 | + - marker_start: '# --- START FLUX CLI AUTOLOAD ---' |
| 52 | + - name: 'C:\Program Files\PowerShell\7\profile.ps1' |
| 53 | + - onlyif: |
| 54 | + - 'Test-Path "C:\Program Files\PowerShell\7"' |
| 55 | + - shell: powershell |
| 56 | + - require: |
| 57 | + - file: 'Ensure Global PowerShell 7 Profile Exists' |
| 58 | + - cmd: 'Generate Flux CLI PowerShell Autocompletion' |
| 59 | + - file: 'Install user-env setup for Windows container runtimes' |
| 60 | +
|
| 61 | +Ensure Global (default) Windows PowerShell Profile Exists: |
| 62 | + file.managed: |
| 63 | + - name: 'C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1' |
| 64 | + - replace: False |
| 65 | +
|
| 66 | +Ensure Global PowerShell 7 Profile Exists: |
| 67 | + file.managed: |
| 68 | + - name: 'C:\Program Files\PowerShell\7\profile.ps1' |
| 69 | + - onlyif: |
| 70 | + - 'Test-Path "C:\Program Files\PowerShell\7"' |
| 71 | + - shell: powershell |
| 72 | + - replace: False |
| 73 | +
|
| 74 | +Generate Flux CLI PowerShell Autocompletion: |
| 75 | + cmd.run: |
| 76 | + - name: > |
| 77 | + & "{{ install_dir }}flux.exe" completion powershell | |
| 78 | + Out-File -FilePath "{{ install_dir }}flux-completion.ps1" |
| 79 | + -Encoding UTF8 |
| 80 | + - onchanges: |
| 81 | + - archive: 'Extract flux CLI Archive' |
| 82 | + - shell: powershell |
| 83 | +
|
| 84 | +Install user-env setup for Windows container runtimes: |
| 85 | + file.managed: |
| 86 | + - name: '{{ install_dir }}flux-env.ps1' |
| 87 | + - contents: | |
| 88 | + # Ensure Flux and Kind can locate the correct container socket on Windows |
| 89 | + if (Get-Command podman -ErrorAction SilentlyContinue) { |
| 90 | + $env:DOCKER_HOST = "npipe:////./pipe/podman-machine-default" |
| 91 | + } elseif (Get-Command docker -ErrorAction SilentlyContinue) { |
| 92 | + $env:DOCKER_HOST = "npipe:////./pipe/docker_engine" |
| 93 | + } |
| 94 | + - require: |
| 95 | + - sls: {{ sls_package_install }} |
0 commit comments