Skip to content

Commit

Permalink
Removed unused options
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentganne committed Aug 12, 2021
1 parent 50d65de commit 913a1ce
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 38 deletions.
17 changes: 4 additions & 13 deletions org/ystia/docker/images/playbooks/create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,19 @@
state: latest
executable: "{{pip_cmd}}"
when: python_major_version == "2"
- name: Get user defined at runtime
set_fact:
user_loading: "{{RUNTIME_USER}}"
when: RUNTIME_USER != ""
- name: Get user property
set_fact:
user_loading: "{{USER}}"
when: RUNTIME_USER == ""
failed_when: RUNTIME_USER == "" and USER == ""
- name: Add to docker group
- name: Add user to docker group
user:
name: "{{user_loading}}"
name: "{{USER}}"
groups: docker
append: yes
when: user_loading != "root"
when: USER != "root"
- name: Install 'docker' python package
pip:
name: docker
# In user directory to avoid potential issues with distutils
# see issue https://github.com/pypa/pip/issues/5247
extra_args: --user
executable: "{{pip_cmd}}"
become_user: "{{user_loading}}"
become_user: "{{USER}}"
become_method: sudo

9 changes: 1 addition & 8 deletions org/ystia/docker/images/playbooks/load_archive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
set_fact:
archive_path: "{{PATH}}"
failed_when: PATH == ""
- name: Get user property
set_fact:
user_loading: "{{USER}}"
- name: Default user is root
set_fact:
user_loading: "root"
when: USER == ""
- name: Load tar archive
docker_image:
name: "{{NAME}}"
Expand All @@ -27,7 +20,7 @@
source: load
force_source: "{{FORCE_LOAD}}"
become: true
become_user: "{{user_loading}}"
become_user: "{{USER}}"
become_method: sudo
register: result
- name: Fail if the image specified does not correpond to the archive specified
Expand Down
13 changes: 2 additions & 11 deletions org/ystia/docker/images/playbooks/remove_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,12 @@
- name: "Get image {{NAME}} in regsitry"
set_fact:
images: "{{REPO_TAGS | from_json}}"
- name: Get user defined at runtime
set_fact:
user_loading: "{{RUNTIME_USER}}"
when: RUNTIME_USER != ""
- name: Get user property
set_fact:
user_loading: "{{USER}}"
when: RUNTIME_USER == ""
failed_when: RUNTIME_USER == "" and USER == ""
- name: "Remove image {{NAME}} {{TAG}}"
docker_image:
name: "{{images[0]}}"
state: absent
when: images | length == 1
become_user: "{{user_loading}}"
become_user: "{{USER}}"
become_method: sudo
- name: "Remove image {{NAME}} {{TAG}}"
docker_image:
Expand All @@ -35,5 +26,5 @@
repository: "{{REPOSITORY}}"
state: absent
when: images | length != 1
become_user: "{{user_loading}}"
become_user: "{{USER}}"
become_method: sudo
18 changes: 12 additions & 6 deletions org/ystia/docker/images/types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
template_version: 3.0.0-SNAPSHOT
template_author: Ystia


description: Docker image types

imports:
- tosca-normative-types:1.0.0-ALIEN20
Expand Down Expand Up @@ -57,11 +57,6 @@ node_types:
description: Perform the operation as this existing user
default: root
required: false
attributes:
# Array of repository name:tag in registry for the specified name.
# Empty if no name was specified or if the image was already loaded
# and force_load is set to false
repo_tags: { get_operation_output: [SELF, Standard, start, REPO_TAGS] }
org.ystia.docker.images.ArchiveLoader:
derived_from: org.ystia.docker.images.pub.ArchiveLoader
description: Loads a docker image from a tar archive
Expand All @@ -71,6 +66,11 @@ node_types:
description: >
Path to the tar archive (can be compressed with gzip, bzip2, or xz)).
required: true
attributes:
# Array of repository name:tag in registry for the specified name.
# Empty if no name was specified or if the image was already loaded
# and force_load is set to false
repo_tags: { get_operation_output: [SELF, Standard, start, REPO_TAGS] }
interfaces:
Standard:
inputs:
Expand Down Expand Up @@ -103,6 +103,11 @@ node_types:
capability: org.ystia.docker.images.capabilities.ArchiveProvider
relationship: org.ystia.docker.images.relationships.ArchiveProvider
occurrences: [1, 1]
attributes:
# Array of repository name:tag in registry for the specified name.
# Empty if no name was specified or if the image was already loaded
# and force_load is set to false
repo_tags: { get_operation_output: [SELF, Standard, start, REPO_TAGS] }
interfaces:
Standard:
inputs:
Expand Down Expand Up @@ -137,6 +142,7 @@ capability_types:
user:
type: string
description: User having access to this archive
default: root
relationship_types:
org.ystia.docker.images.relationships.ArchiveProvider:
derived_from: tosca.relationships.DependsOn
Expand Down

0 comments on commit 913a1ce

Please sign in to comment.