Skip to content

Commit 4dba309

Browse files
committed
fixed application credentials usage
1 parent ba8be5c commit 4dba309

File tree

4 files changed

+28
-27
lines changed

4 files changed

+28
-27
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ wheels/
2222
*.egg-info/
2323
.installed.cfg
2424
*.egg
25-
25+
.env.dsi
2626
# PyInstaller
2727
# Usually these files are written by a python script from a template
2828
# before PyInstaller builds the exe, so as to inject date/other infos into it.

plays/setup_basics.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@
7171
community.docker.docker_prune:
7272
containers: yes
7373
images: yes
74-
images_filter:
75-
dangling: false
7674
networks: yes
7775

7876
- name: "Ensure the user {{ ansible_user }} is part of the docker group"

plays/setup_client.yml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
- name: Copy specified client config file to remote machine
5151
copy: src={{ item.src }} dest={{ item.dest }}
5252
with_items:
53-
- { src: "{{client_config}}", dest: "{{ client.PERSISTENT_PATH }}/config.yml" }
53+
- { src: "{{client_config}}", dest: "{{ client.PERSISTENT_PATH }}/config.yml" }
5454
when: client_config is defined
5555
tags: always
5656

@@ -64,7 +64,7 @@
6464
- name: Copy specified server pem file to remote machine persistent from default path
6565
copy: src={{ item.src }} dest={{ item.dest }}
6666
with_items:
67-
- { src: "{{client.CERT_FILE_PATH}}", dest: "{{ client.PERSISTENT_PATH }}/server.pem" }
67+
- { src: "{{client.CERT_FILE_PATH}}", dest: "{{ client.PERSISTENT_PATH }}/server.pem" }
6868
when: client_server_pem is not defined and stat_client_pem.stat.exists == False
6969
tags: always
7070

@@ -78,7 +78,7 @@
7878
- name: Copy specified ca pem file to remote machine persistent from default path
7979
copy: src={{ item.src }} dest={{ item.dest }}
8080
with_items:
81-
- { src: "{{client.CA_FILE_PATH}}", dest: "{{ client.PERSISTENT_PATH }}/CA.pem" }
81+
- { src: "{{client.CA_FILE_PATH}}", dest: "{{ client.PERSISTENT_PATH }}/CA.pem" }
8282
when: client_ca_pem is not defined and stat_ca_pem.stat.exists == False
8383
tags: always
8484

@@ -114,10 +114,25 @@
114114
shell: rm -f "{{ client.REPO_PATH }}"/.ansible_environment && jq -r '.[]|"\(.key)=\(.value)"' "{{ client.REPO_PATH }}"/.ansible_environment_*.json >> "{{ client.REPO_PATH }}"/.ansible_environment
115115
tags: always
116116

117-
- name: Append variables to env file
118-
shell: cat "{{ client.REPO_PATH }}"/.ansible_environment >> "{{ client.REPO_PATH }}"/.env
119-
tags: always
120117

118+
- name: Read existing content from .ansible_environment
119+
slurp:
120+
src: "{{ client.REPO_PATH }}/.ansible_environment"
121+
register: existing_content
122+
123+
- name: Append variables with empty line to .env
124+
lineinfile:
125+
path: "{{ client.REPO_PATH }}/.env"
126+
insertafter: EOF
127+
line: ""
128+
state: present
129+
create: yes
130+
- name: Append existing content to .env
131+
lineinfile:
132+
path: "{{ client.REPO_PATH }}/.env"
133+
insertafter: ""
134+
line: "{{ existing_content.content | b64decode | string }}"
135+
tags: always
121136
# Start
122137
- name: Start client docker container without bibigrid
123138
docker_compose:
@@ -131,10 +146,10 @@
131146

132147
- name: Start docker container with bibigrid
133148
docker_compose:
134-
recreate: always
135-
pull: yes
136-
project_src: "{{ client.REPO_PATH }}"
137-
files:
138-
- docker-compose.bibigrid.yml
149+
recreate: always
150+
pull: yes
151+
project_src: "{{ client.REPO_PATH }}"
152+
files:
153+
- docker-compose.bibigrid.yml
139154
become: yes
140-
tags: ['never', 'bibigrid']
155+
tags: [ 'never', 'bibigrid' ]

simple_vm_client/VirtualMachineServer.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@
2020
PROJECT_DOMAIN_ID = "OS_PROJECT_DOMAIN_ID"
2121
FORC_API_KEY = "FORC_API_KEY"
2222

23-
environment_variables = [
24-
USERNAME,
25-
PASSWORD,
26-
PROJECT_NAME,
27-
PROJECT_ID,
28-
USER_DOMAIN_ID,
29-
AUTH_URL,
30-
PROJECT_DOMAIN_ID,
31-
FORC_API_KEY,
32-
]
33-
3423

3524
@click.command()
3625
@click.argument("config")
@@ -94,5 +83,4 @@ def check_env(var: str) -> None:
9483

9584

9685
if __name__ == "__main__":
97-
check_environment_variables(environment_variables)
9886
startServer()

0 commit comments

Comments
 (0)