diff --git a/ansible/deploy_aw_windows.yml b/ansible/deploy_aw_windows.yml index 92a352b..2f599cc 100644 --- a/ansible/deploy_aw_windows.yml +++ b/ansible/deploy_aw_windows.yml @@ -201,7 +201,12 @@ - aw_windows_afk_enabled | bool - aw_windows_hostname_result.stdout is defined ansible.builtin.set_fact: - aw_windows_api_smoke_check_bucket_effective: "aw-watcher-afk_{{ aw_windows_hostname_result.stdout | trim }}" + aw_windows_api_smoke_check_bucket_effective: >- + {{ + aw_windows_api_smoke_check_bucket + if (aw_windows_api_smoke_check_bucket | default('') | string | length) > 0 + else 'aw-watcher-afk_' ~ (aw_windows_hostname_result.stdout | trim) + }} - name: Выполнить AW API smoke-check (проверка наличия свежих событий в AFK бакете) when: diff --git a/ansible/post_validate_aw_windows.yml b/ansible/post_validate_aw_windows.yml index 2f28634..db8dfda 100644 --- a/ansible/post_validate_aw_windows.yml +++ b/ansible/post_validate_aw_windows.yml @@ -4,6 +4,14 @@ gather_facts: false vars: + aw_windows_deploy_root: "C:\\Program Files\\AWatch-rus" + aw_windows_state_root: "C:\\ProgramData\\AWatch-rus" + aw_windows_validation_remote_path: "{{ aw_windows_state_root }}\\aw_validate_ansible.json" + aw_windows_validation_local_dir: "/tmp/aw-rus-validation" + aw_windows_server_scheme: "http" + aw_windows_server_host: "10.10.10.13" + aw_windows_server_port: 5600 + aw_windows_fail_on_validation_error: true aw_windows_launch_task_pattern: "ActivityWatch Launch *" aw_windows_recovery_task_name: "ActivityWatch Recovery" aw_windows_force_task_restart: true @@ -44,6 +52,7 @@ ansible.builtin.uri: url: "{{ aw_windows_server_scheme }}://{{ aw_windows_server_host }}:{{ aw_windows_server_port }}/api/0/buckets/{{ aw_windows_api_smoke_check_bucket_effective }}/events?limit={{ aw_windows_api_smoke_check_limit }}" method: GET + status_code: 200 return_content: true register: aw_windows_api_smoke until: > @@ -87,4 +96,3 @@ msg: - "Validation OK on {{ inventory_hostname }}." - "Report: {{ aw_windows_validation_local_dir }}/{{ inventory_hostname }}-aw_validate_ansible.json" - diff --git a/windows/ActivityWatch.Windows.Common.psm1 b/windows/ActivityWatch.Windows.Common.psm1 index 71e573f..94d7102 100755 --- a/windows/ActivityWatch.Windows.Common.psm1 +++ b/windows/ActivityWatch.Windows.Common.psm1 @@ -718,11 +718,11 @@ function Start-CollectorScriptIfNeeded { return } - $staParam = if (`$ScriptPath -like "*endpoint-signals*") { "-STA" } else { $null } - $argumentList = @('-NoProfile', '-WindowStyle', 'Hidden', '-ExecutionPolicy', 'Bypass') - if ($staParam) { $argumentList += $staParam } - $argumentList += @('-File', `$ScriptPath, '-ConfigPath', `$ConfigPath) - Start-Process -FilePath `$PowerShellExe -ArgumentList $argumentList -WindowStyle Hidden + `$staParam = if (`$ScriptPath -like "*endpoint-signals*") { "-STA" } else { $null } + `$argumentList = @('-NoProfile', '-WindowStyle', 'Hidden', '-ExecutionPolicy', 'Bypass') + if (`$staParam) { `$argumentList += `$staParam } + `$argumentList += @('-File', `$ScriptPath, '-ConfigPath', `$ConfigPath) + Start-Process -FilePath `$PowerShellExe -ArgumentList `$argumentList -WindowStyle Hidden } `$config = Get-DeploymentConfig -Path `$ConfigPath