diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 871c1b1..9452bf3 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.1.0 +current_version = 0.1.1 commit = True message = Bumps version to {new_version} tag = False diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c91ec4..964cf48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,3 +25,56 @@ jobs: salt-os-version: ${{ matrix.os_version }} salt-state: ${{ matrix.salt_state }} salt-pillar-root: ${{ matrix.salt_pillar_root }} + + windows: + uses: plus3it/actions-workflows/.github/workflows/test-salt-windows.yml@ddd67e99878a285f728de398c1116151c2d7791a + strategy: + matrix: + os_version: + - windows-2019 + - windows-2022 + - windows-2025 + salt_state: + - postman-api + salt_pillar_root: + - ./tests/pillar/test-postman-api + with: + salt-os-version: ${{ matrix.os_version }} + salt-state: ${{ matrix.salt_state }} + salt-pillar-root: ${{ matrix.salt_pillar_root }} + + + lint_powershell: + name: PowerShell Linting + runs-on: windows-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Run PSScriptAnalyzer + shell: pwsh + run: | + $files = Get-ChildItem -Path ./ -Include *.ps1 -Recurse + Write-Host "--- Starting PowerShell Static Analysis ---" + + $anyErrors = $false + + foreach ($file in $files) { + $relativePath = $file.FullName.Replace($PWD.ProviderPath, ".") + $results = Invoke-ScriptAnalyzer -Path $file.FullName -Severity Warning + + if ($results) { + Write-Host "FAIL: $relativePath" -ForegroundColor Red + $results | Format-Table -AutoSize + $anyErrors = $true + } else { + Write-Host "PASS: $relativePath" -ForegroundColor Green + } + } + + if ($anyErrors) { + Write-Error "Static analysis failed. Please fix the errors above." + exit 1 + } else { + Write-Host "--- All files passed analysis! ---" + } diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b139a..b0a9737 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +### 0.1.1 + +**Released**: 2026.06.04 + +**Summary**: + +* Added Windows functionality + * Installs the Postman API binary (as downloaded from [vendor site](https://www.postman.com/downloads/)) + * Install-location defaults to `C:\Program Files\Postman` + * Install-location overrideable via Pillar's `install_root` parameter + * Installs latest installable version — v12.13.5 as of this document's writing (override via Pillar's `download_uri` parameter) + * Sets appropriate ownerships, permissions, etc. on content loaded into `install_root` + * Creates a desktop-launcher icon for all users + * Creates a launcher icon in the `Start` menus for all users + * Configures the launchers to constrain the initial-startup window to 85% of the display size +* Adds CI tests for Windows platforms (currently Windows Server 2019, 2022 and 2025) +* Updates pillar.example to explain Windows-specific parameters/inputs that may be specified via Pillar +* Update README with platform-notes + ### 0.1.0 **Released**: 2026.06.02 diff --git a/README.md b/README.md index 477a56a..6ce2881 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,10 @@ Executes _just_ the `config` state to uninstall the Postman API client-configura 1. Due to library compatibilities, the installable version of Postman on RHEL 9 (and derivatives) is constrained to < `11.x`. This formula defaults the RHEL 9 (and derivatives) installation to Postman version `10.24.26` 1. To support hardened enterprise baselines (such as the DISA STIG or CIS profiles), this formula defaults to disabling the Chromium application sandbox (`sandbox_enabled: false`) on Red Hat family distributions. These security profiles typically disable unprivileged user namespaces (`user.max_user_namespaces = 0`), which causes Electron-based applications to crash instantly on startup. For less restrictive environments where user namespaces are permitted, the sandbox can be safely re-enabled by setting `sandbox_enabled: true` via Pillar data. +### Windows + +1. **Headless Session 0 Execution:** The native Squirrel-based Postman installer package will deadlock or hang indefinitely when executed inside a headless `SYSTEM` context (Session 0) because it attempts to synchronously generate user-centric desktop interactive pathways. This formula handles this limitation by staging a purpose-built PowerShell management wrapper (`install_postman.ps1`) that orchestrates a monitored extraction, forces termination of the blocked installation threads, migrates application files to the designated global `install_root`, and purges staging profiles. +2. **Virtual Framebuffer Scaling Overrides:** To prevent the hardcoded Electron canvas landing layout from overflowing low-resolution framebuffers typical of remote automated pipelines or thin management consoles, system shortcuts are automatically configured with Chromium layout engine switches (`--window-size=1024,768` and `--force-device-scale-factor=0.85`) to guarantee complete interface visibility. [^1]: As of this README's writing, only Enterprise Linux and related distros (Red Hat and Oracle Enterprise, CentOS Stream, Rocky and Alma Linux). It has only been specifically tested with EL **_9_** variants. [^2]: As of this README's writing, this functionality has only been tested on Windows Server 2022 diff --git a/pillar.example b/pillar.example index 0e1b85f..2be9d18 100644 --- a/pillar.example +++ b/pillar.example @@ -3,14 +3,15 @@ --- postman-api: config: - # Path where the system desktop entry file will be generated. + # Path where the system desktop entry file will be generated (Linux only). desktop_entry: '/usr/share/applications/postman.desktop' # Relative path to the application icon inside the installation directory. icon_source: '/app/resources/app/assets/icon.png' # The root directory tree where the application archive is extracted. - # Natively supports paths containing spaces (e.g., '/opt/Desktop Apps/Postman'). + # Natively supports Linux paths and Windows filesystem paths + # (e.g., 'C:\Program Files\Postman'). install_root: '/opt/Postman' # Controls Chromium's internal application isolation sandbox layer. @@ -35,6 +36,8 @@ postman-api: whitelist_enabled: true # The system path for the generated wrapper execution bash script. + # Supports Linux paths and Windows execution script pathways + # (e.g., 'C:\Program Files\Postman\postman.cmd'). wrapper_bin: '/usr/local/bin/postman' pkg: @@ -48,4 +51,8 @@ postman-api: # The internal name designation used for formula mapping identification. name: 'postman-api' + + # The target application version string expected for the deployment + # (e.g., '12.13.5' or 'latest'). Used primarily by Windows targets. + version: 'latest' ... diff --git a/postman-api/config/file.sls b/postman-api/config/file.sls index 151a76f..b59a003 100644 --- a/postman-api/config/file.sls +++ b/postman-api/config/file.sls @@ -13,6 +13,7 @@ include: - postman-api.config.lin_file {%- elif grains.kernel == "Windows" %} - postman-api.config.win_file + - postman-api.config.win_readiness {%- endif %} Avoid being a null-router (config/file) - Postman API: diff --git a/postman-api/config/win_clean.sls b/postman-api/config/win_clean.sls index e69de29..2c12bd3 100644 --- a/postman-api/config/win_clean.sls +++ b/postman-api/config/win_clean.sls @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} +{%- set image_execution_options_reg = + 'HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\' + ~ 'Image File Execution Options\\Postman.exe' %} +{%- set start_menu_shortcut_path = + 'C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Postman.lnk' %} + +Remove Postman Desktop Shortcut: + file.absent: + - name: 'C:\Users\Public\Desktop\Postman.lnk' + +Remove Process Mitigation Exclusions: + reg.absent: + - name: '{{ image_execution_options_reg }}' + +Remove Protocol Deep Linking Registration: + reg.absent: + - name: 'HKLM\SOFTWARE\Classes\postman' + +Remove Start Menu Shortcut: + file.absent: + - name: '{{ start_menu_shortcut_path }}' + +Reverse Global Suppression of Automatic Updates: + host.absent: + - ip: '127.0.0.1' + - name: 'dl.pstmn.io' diff --git a/postman-api/config/win_file.sls b/postman-api/config/win_file.sls index e69de29..ff828d0 100644 --- a/postman-api/config/win_file.sls +++ b/postman-api/config/win_file.sls @@ -0,0 +1,76 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} + +Configure Postman Desktop Shortcut: + shortcut.present: + - arguments: '--window-size=1024,768 --force-device-scale-factor=0.85' + - icon_index: 0 + - icon_location: '{{ postman_api.config.install_root }}\Postman.exe' + - name: 'C:\Users\Public\Desktop\Postman.lnk' + - target: '{{ postman_api.config.install_root }}\Postman.exe' + - working_dir: '{{ postman_api.config.install_root }}' + +Configure Process Mitigation Exclusions: + cmd.run: + - name: >- + Set-ProcessMitigation + -Name Postman.exe + -Disable DisallowChildProcessCreation + - shell: powershell + - unless: >- + $postmanProcessMitigation = Get-ProcessMitigation + -Name Postman.exe -ErrorAction SilentlyContinue; + $childProcessStatus = $postmanProcessMitigation. + ChildProcess.DisallowChildProcessCreation; + if ($childProcessStatus -eq 'OFF') { exit 0 } + else { exit 1 } + +Configure Protocol Deep Linking Base: + reg.present: + - name: 'HKLM\SOFTWARE\Classes\postman' + - vdata: 'URL:postman Protocol' + - vname: '(Default)' + - vtype: REG_SZ + +Configure Protocol Deep Linking Command: + reg.present: + - name: 'HKLM\SOFTWARE\Classes\postman\shell\open\command' + - vdata: '"{{ postman_api.config.install_root }}\Postman.exe" "%1"' + - vname: '(Default)' + - vtype: REG_SZ + +Configure Protocol Deep Linking Protocol Value: + reg.present: + - name: 'HKLM\SOFTWARE\Classes\postman' + - vdata: '' + - vname: 'URL Protocol' + - vtype: REG_SZ + +Configure Start Menu Shortcut: + shortcut.present: + - arguments: '--window-size=1024,768 --force-device-scale-factor=0.85' + - icon_index: 0 + - icon_location: '{{ postman_api.config.install_root }}\Postman.exe' + - name: 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Postman.lnk' + - target: '{{ postman_api.config.install_root }}\Postman.exe' + - working_dir: '{{ postman_api.config.install_root }}' + +Harden Postman Directory Permissions: + file.directory: + - name: '{{ postman_api.config.install_root }}' + - win_inheritance: true + - win_owner: 'BUILTIN\Administrators' + - win_perms: + BUILTIN\Administrators: + perms: full_control + BUILTIN\Users: + perms: read_execute + +Suppress Automatic Updates Globally: + host.present: + - ip: '127.0.0.1' + - name: 'dl.pstmn.io' diff --git a/postman-api/config/win_readiness.sls b/postman-api/config/win_readiness.sls new file mode 100644 index 0000000..284dfcd --- /dev/null +++ b/postman-api/config/win_readiness.sls @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} + +Configure Postman API into System PATH Entry: + win_path.exists: + - name: '{{ postman_api.config.install_root }}' + +Opt Out of Postman API Telemetry: + environ.setenv: + - name: POSTMAN_DISABLE_TELEMETRY + - permanent: HKLM + - value: '1' diff --git a/postman-api/files/install_postman.ps1 b/postman-api/files/install_postman.ps1 new file mode 100644 index 0000000..832a356 --- /dev/null +++ b/postman-api/files/install_postman.ps1 @@ -0,0 +1,154 @@ +<# +.SYNOPSIS + Headless installation wrapper for the Squirrel-based Postman installer. +.DESCRIPTION + Installs Postman inside a headless Session 0 (SYSTEM) context. Because + the native Postman installer deadlocks trying to create interactive + desktop shortcuts, this script orchestrates a monitored extraction, + terminates the stuck processes, migrates binaries to a global target + root, and purges the temporary system profile staging directories. +.PARAMETER DownloadUri + The fully qualified download URI for the installer package. +.PARAMETER InstallRoot + The system-wide path where the Postman application binaries will be + permanently copied (e.g., 'C:\Program Files\Postman'). +.PARAMETER TargetVersion + The specific version string expected for the deployment (e.g., '12.13.4'). +.PARAMETER CheckOnly + A switch flag to return the system validation status to the caller + without invoking downloading or extraction sequences. +.EXAMPLE + .\install_postman.ps1 ` + -DownloadUri "https://dl.pstmn.io/download/latest/win64" ` + -InstallRoot "C:\Program Files\Postman" ` + -TargetVersion "latest" +#> +param ( + [Parameter(Mandatory = $true)] + [string]$DownloadUri, + + [Parameter(Mandatory = $true)] + [string]$InstallRoot, + + [Parameter(Mandatory = $true)] + [string]$TargetVersion, + + [switch]$CheckOnly +) + +# Guard block ensuring version-based script idempotency +$PostmanExePath = Join-Path $InstallRoot 'Postman.exe' +if (Test-Path $PostmanExePath) { + $FileInfo = Get-Item $PostmanExePath + $InstalledProductVersion = $FileInfo.VersionInfo.ProductVersion + + $IsVendorUrl = $DownloadUri -like '*dl.pstmn.io*' + if ($TargetVersion -eq 'latest' -and $IsVendorUrl) { + $BaseUrl = 'https://dl.pstmn.io/update/status' + $Query = '?currentVersion=12.0.0&platform=win64' + $StatusUrl = $BaseUrl + $Query + $RestArgs = @{ + ErrorAction = 'SilentlyContinue' + Uri = $StatusUrl + } + $UpdateStatus = Invoke-RestMethod @RestArgs + if ($UpdateStatus -and $UpdateStatus.version) { + $TargetVersion = $UpdateStatus.version + } + } + + $IsLatestMatched = $TargetVersion -eq 'latest' + $IsVersionMatch = $InstalledProductVersion -match $TargetVersion + if ($IsLatestMatched -or $IsVersionMatch) { + Write-Output "Postman version $InstalledProductVersion is up to date." + exit 0 + } +} + +# If execution reaches here, the package is missing or outdated. +if ($CheckOnly) { + Write-Output "Postman requires installation or update." + exit 1 +} + +$SetupExe = 'C:\Windows\Temp\PostmanSetup.exe' +$StartArgs = @{ + ArgumentList = '--silent' + FilePath = $SetupExe +} +Start-Process @StartArgs + +$SourceDir = Join-Path $env:LOCALAPPDATA 'Postman' +$TimeoutSeconds = 90 +$Timer = [System.Diagnostics.Stopwatch]::StartNew() +$LastSize = -1 +$StableCount = 0 + +while ($StableCount -lt 3) { + if ($Timer.Elapsed.TotalSeconds -gt $TimeoutSeconds) { + break + } + Start-Sleep -Seconds 2 + if (Test-Path $SourceDir) { + $GciArgs = @{ + ErrorAction = 'SilentlyContinue' + File = $true + Path = $SourceDir + Recurse = $true + } + $Files = Get-ChildItem @GciArgs + $CurrentSize = ($Files | Measure-Object -Sum Length).Sum + if ($CurrentSize -eq $LastSize -and $CurrentSize -gt 0) { + $StableCount++ + } else { + $LastSize = $CurrentSize + $StableCount = 0 + } + } +} + +$KillList = @('PostmanSetup', 'Update', 'Postman') +foreach ($Name in $KillList) { + $KillArgs = @{ + ErrorAction = 'SilentlyContinue' + Force = $true + Name = $Name + } + Stop-Process @KillArgs +} + +if (Test-Path $SourceDir) { + if (Test-Path $InstallRoot) { + # Purge existing installations completely to prevent directory bloat + $PurgeArgs = @{ + ErrorAction = 'SilentlyContinue' + Force = $true + Path = Join-Path $InstallRoot '*' + Recurse = $true + } + Remove-Item @PurgeArgs + } else { + $DirArgs = @{ + Force = $true + ItemType = 'Directory' + Path = $InstallRoot + } + New-Item @DirArgs + } + + $CopyArgs = @{ + Destination = $InstallRoot + Force = $true + Path = Join-Path $SourceDir '*' + Recurse = $true + } + Copy-Item @CopyArgs + + $RemoveArgs = @{ + ErrorAction = 'SilentlyContinue' + Force = $true + Path = $SourceDir + Recurse = $true + } + Remove-Item @RemoveArgs +} diff --git a/postman-api/package/win_clean.sls b/postman-api/package/win_clean.sls index e69de29..c0c0e88 100644 --- a/postman-api/package/win_clean.sls +++ b/postman-api/package/win_clean.sls @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} + +Remove Postman Installation Directory: + file.absent: + - name: '{{ postman_api.config.install_root }}' + +Remove Postman Staged Installer: + file.absent: + - name: 'C:\Windows\Temp\PostmanSetup.exe' + +Remove Postman Staged Script: + file.absent: + - name: 'C:\Windows\Temp\install_postman.ps1' diff --git a/postman-api/package/win_install.sls b/postman-api/package/win_install.sls index e69de29..431f8ee 100644 --- a/postman-api/package/win_install.sls +++ b/postman-api/package/win_install.sls @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# vim: ft=sls + +{#- Get the `tplroot` from `tpldir` #} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} + +Download Postman Installer: + file.managed: + - makedirs: true + - name: 'C:\Windows\Temp\PostmanSetup.exe' + - require: + - file: Stage Installation Script + {%- if postman_api.pkg.download_sig %} + - source: '{{ postman_api.pkg.download_uri }}' + - source_hash: '{{ postman_api.pkg.download_sig }}' + {%- else %} + - skip_verify: true + - source: '{{ postman_api.pkg.download_uri }}' + {%- endif %} + - unless: >- + powershell -ExecutionPolicy Bypass -File + C:\Windows\Temp\install_postman.ps1 + -CheckOnly + -DownloadUri "{{ postman_api.pkg.download_uri }}" + -InstallRoot "{{ postman_api.config.install_root }}" + -TargetVersion "{{ postman_api.pkg.version }}" + +Execute Postman Installation: + cmd.run: + - name: >- + powershell -ExecutionPolicy Bypass -File + C:\Windows\Temp\install_postman.ps1 + -DownloadUri "{{ postman_api.pkg.download_uri }}" + -InstallRoot "{{ postman_api.config.install_root }}" + -TargetVersion "{{ postman_api.pkg.version }}" + - require: + - file: Download Postman Installer + - file: Stage Installation Script + - shell: powershell + - unless: >- + powershell -ExecutionPolicy Bypass -File + C:\Windows\Temp\install_postman.ps1 + -CheckOnly + -DownloadUri "{{ postman_api.pkg.download_uri }}" + -InstallRoot "{{ postman_api.config.install_root }}" + -TargetVersion "{{ postman_api.pkg.version }}" + +Stage Installation Script: + file.managed: + - makedirs: true + - name: 'C:\Windows\Temp\install_postman.ps1' + - source: salt://postman-api/files/install_postman.ps1 diff --git a/postman-api/parameters/defaults.yaml b/postman-api/parameters/defaults.yaml index 819b999..5d9f404 100644 --- a/postman-api/parameters/defaults.yaml +++ b/postman-api/parameters/defaults.yaml @@ -18,5 +18,6 @@ values: download_sig: '' download_uri: '' name: 'postman-api' + version: 'latest' service: {} ... diff --git a/postman-api/parameters/os_family/Windows.yaml b/postman-api/parameters/os_family/Windows.yaml new file mode 100644 index 0000000..4310382 --- /dev/null +++ b/postman-api/parameters/os_family/Windows.yaml @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +values: + config: + install_root: 'C:\Program Files\Postman' + wrapper_bin: 'C:\Program Files\Postman\postman.cmd' + pkg: + download_sig: '' + download_uri: 'https://dl.pstmn.io/download/latest/win64' + name: 'postman-api' + version: 'latest' + service: {} +... diff --git a/postman-api/service/clean.sls b/postman-api/service/clean.sls deleted file mode 100644 index 02bed28..0000000 --- a/postman-api/service/clean.sls +++ /dev/null @@ -1,11 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} - -postman-api-service-clean-service-dead: - service.dead: - - name: {{ postman_api.service.name }} - - enable: False diff --git a/postman-api/service/init.sls b/postman-api/service/init.sls deleted file mode 100644 index 6fe4d1a..0000000 --- a/postman-api/service/init.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .running diff --git a/postman-api/service/running.sls b/postman-api/service/running.sls deleted file mode 100644 index a631f61..0000000 --- a/postman-api/service/running.sls +++ /dev/null @@ -1,17 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_config_file = tplroot ~ '.config.file' %} -{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} - -include: - - {{ sls_config_file }} - -postman-api-service-running-service-running: - service.running: - - name: {{ postman_api.service.name }} - - enable: True - - watch: - - sls: {{ sls_config_file }} diff --git a/postman-api/subcomponent/clean.sls b/postman-api/subcomponent/clean.sls deleted file mode 100644 index 564769d..0000000 --- a/postman-api/subcomponent/clean.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .config.clean diff --git a/postman-api/subcomponent/config/clean.sls b/postman-api/subcomponent/config/clean.sls deleted file mode 100644 index cbda35b..0000000 --- a/postman-api/subcomponent/config/clean.sls +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_service_clean = tplroot ~ '.service.clean' %} -{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} - -include: - - {{ sls_service_clean }} - -postman-api-subcomponent-config-clean-file-absent: - file.absent: - - name: {{ postman_api.subcomponent.config }} - - watch_in: - - sls: {{ sls_service_clean }} diff --git a/postman-api/subcomponent/config/file.sls b/postman-api/subcomponent/config/file.sls deleted file mode 100644 index 86be126..0000000 --- a/postman-api/subcomponent/config/file.sls +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -{#- Get the `tplroot` from `tpldir` #} -{%- set tplroot = tpldir.split('/')[0] %} -{%- set sls_config_file = tplroot ~ '.config.file' %} -{%- from tplroot ~ "/map.jinja" import mapdata as postman_api with context %} -{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} - -include: - - {{ sls_config_file }} - -postman-api-subcomponent-config-file-file-managed: - file.managed: - - name: {{ postman_api.subcomponent.config }} - - source: {{ files_switch(['subcomponent-example.tmpl'], - lookup='postman-api-subcomponent-config-file-file-managed', - use_subpath=True - ) - }} - - mode: 644 - - user: root - - group: {{ postman_api.rootgroup }} - - makedirs: True - - template: jinja - - require_in: - - sls: {{ sls_config_file }} diff --git a/postman-api/subcomponent/config/files/default/subcomponent-example.tmpl b/postman-api/subcomponent/config/files/default/subcomponent-example.tmpl deleted file mode 100644 index 522de00..0000000 --- a/postman-api/subcomponent/config/files/default/subcomponent-example.tmpl +++ /dev/null @@ -1,6 +0,0 @@ -######################################################################## -# File managed by Salt at <{{ source }}>. -# Your changes will be overwritten. -######################################################################## - -This is a subcomponent example file from SaltStack template-formula. diff --git a/postman-api/subcomponent/config/files/default/subcomponent-example.tmpl.jinja b/postman-api/subcomponent/config/files/default/subcomponent-example.tmpl.jinja deleted file mode 100644 index cbfd51d..0000000 --- a/postman-api/subcomponent/config/files/default/subcomponent-example.tmpl.jinja +++ /dev/null @@ -1,6 +0,0 @@ -######################################################################## -# File managed by Salt at <{{ source }}>. -# Your changes will be overwritten. -######################################################################## - -This is another subcomponent example file from SaltStack template-formula. diff --git a/postman-api/subcomponent/config/init.sls b/postman-api/subcomponent/config/init.sls deleted file mode 100644 index 465ddfe..0000000 --- a/postman-api/subcomponent/config/init.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .file diff --git a/postman-api/subcomponent/init.sls b/postman-api/subcomponent/init.sls deleted file mode 100644 index 6003be1..0000000 --- a/postman-api/subcomponent/init.sls +++ /dev/null @@ -1,5 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: ft=sls - -include: - - .config diff --git a/tests/.gitkeep b/tests/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/tests/pillar/postman-api/main.sls b/tests/pillar/postman-api/main.sls index 68e700c..89f83a1 100644 --- a/tests/pillar/postman-api/main.sls +++ b/tests/pillar/postman-api/main.sls @@ -1,4 +1,4 @@ -nosql-booster: +postman-api: lookup: {%- if grains.os_family == "RedHat" %} pkg: