Skip to content

Commit

Permalink
fix(create_shell_extension): import {app,monitor}_hostname site-speci…
Browse files Browse the repository at this point in the history
…fic variables

---rather than overriding them globally as facts.

(cherry picked from commit bf20c4f)
  • Loading branch information
cfm authored and zenmonkeykstop committed Jun 15, 2023
1 parent f1bf1a4 commit a354afa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
- name: Import variables
include_vars: "group_vars/all/site-specific"

- name: Check for v3 Source Interface file
stat:
path: app-sourcev3-ths
Expand Down Expand Up @@ -26,18 +29,6 @@
register: journalistv3_interface_lookup_result
when: v3_source_file.stat.exists == true

- name: Look up app server hostname
command: "awk -v FS='app_hostname: ' 'NF>1{print $2}' group_vars/all/site-specific"
changed_when: false
register: app_server_lookup_result
when: site_specific_file.stat.exists == true

- name: Look up mon server hostname
command: "awk -v FS='monitor_hostname: ' 'NF>1{print $2}' /home/amnesia/Persistent/securedrop/install_files/ansible-base/group_vars/all/site-specific"
changed_when: false
register: mon_server_lookup_result
when: site_specific_file.stat.exists == true

- name: Create the SecureDrop GNOME Shell Extension directories
file:
state: directory
Expand Down Expand Up @@ -87,23 +78,13 @@
set_fact:
journalist_iface: "{{ journalistv3_interface_lookup_result }}"

- name: Set the right variable for app server hostname
set_fact:
app_hostname: "{{ app_server_lookup_result }}"

- name: Set the right variable for app server hostname
set_fact:
mon_hostname: "{{ mon_server_lookup_result }}"

- name: Assemble interface information for extension
set_fact:
_securedrop_extension_info:
- src: extension.js.in
filename: extension.js
source_interface_address: "{{ source_iface.stdout }}"
journalist_interface_address: "{{ journalist_iface.stdout }}"
app_hostname: "{{ app_hostname.stdout }}"
mon_hostname: "{{ mon_hostname.stdout }}"

- name: Create SecureDrop extension
become: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const Domain = Gettext.domain(GETTEXT_DOMAIN)

const source_interface_address = "{{ item.0.source_interface_address }}";
const journalist_interface_address = "{{ item.0.journalist_interface_address }}";
const app_server_hostname = "{{ item.0.app_hostname }}";
const mon_server_hostname = "{{ item.0.mon_hostname }}";
const app_server_hostname = "{{ app_hostname }}";
const mon_server_hostname = "{{ monitor_hostname }}";

const _ = Domain.gettext;

Expand Down

0 comments on commit a354afa

Please sign in to comment.