Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assemble module: Adds an extra line if the delimiter parameter is set to "\n" #44739

Closed
in-in opened this issue Aug 27, 2018 · 2 comments · Fixed by #54176
Closed

assemble module: Adds an extra line if the delimiter parameter is set to "\n" #44739

in-in opened this issue Aug 27, 2018 · 2 comments · Fixed by #54176
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. files Files category has_pr This issue has an associated PR. module This issue/PR relates to a module. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@in-in
Copy link

in-in commented Aug 27, 2018

SUMMARY

I want to add a new line between my fragments. For this, I set the delimiter parameter to '/n"', but I got two lines between the fragments. In case I omit the delimiter parameter my fragments are combined without any delimiter

ISSUE TYPE
  • Bug Report
COMPONENT NAME

assemble

ANSIBLE VERSION
ansible 2.6.3
  config file = /home/mint/assemble_module_test/ansible.cfg
  configured module search path = ['/home/mint/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.6/dist-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.6.5 (default, Apr  1 2018, 05:46:30) [GCC 7.3.0]
CONFIGURATION
ANSIBLE_NOCOWS(/home/mint/assemble_module_test/ansible.cfg) = True
DEFAULT_HOST_LIST(/home/mint/assemble_module_test/ansible.cfg) = ['/home/mint/assemble_module_test/hosts.yml']

OS / ENVIRONMENT

Host: Linux Mint 19,
Target: same

STEPS TO REPRODUCE

Minimal test-case repository: https://github.com/in-in/assemble_module_test

- hosts: local
  tasks:
    - name: create main file
      assemble:
        src: "./fragments"
        dest: "./.aliases.sh"
        delimiter: "\n"
EXPECTED RESULTS

.aliases.sh should look like this:

# npm: fix everything
alias npmplease='rm -rf node_modules && npm cache clean && npm install'

# rsnapshot: testing the configuration
alias test_backup="rsnapshot -c ~/.config/rsnapshot/rsnapshot.conf configtest"

# rsnapshot: run backup
alias backup="rsnapshot -V -c ~/.config/rsnapshot/rsnapshot.conf weekly"

# wireguard: up the tunnel
alias wgu='sudo wg-quick up wg0'

# wireguard: down the tunnel
alias wgd='sudo wg-quick down wg0'
ACTUAL RESULTS
# npm: fix everything
alias npmplease='rm -rf node_modules && npm cache clean && npm install'


# rsnapshot: testing the configuration
alias test_backup="rsnapshot -c ~/.config/rsnapshot/rsnapshot.conf configtest"

# rsnapshot: run backup
alias backup="rsnapshot -V -c ~/.config/rsnapshot/rsnapshot.conf weekly"


# wireguard: up the tunnel
alias wgu='sudo wg-quick up wg0'

# wireguard: down the tunnel
alias wgd='sudo wg-quick down wg0'

PS. I found that the problem is in my inventory file. More exactly in this line: ansible_python_interpreter: "{{ ansible_playbook_python }}"
At runtime, it translates to: ansible_python_interpreter: "python3"
If I change this line to ansible_python_interpreter: "python2", it will prevent the appearance of one extra line in the "assemble" module. But Python2 ruins another part of my configuration (dconf module)

@ansibot
Copy link
Contributor

ansibot commented Aug 27, 2018

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Aug 27, 2018

cc @sfromm
click here for bot help

@ansibot ansibot added affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 27, 2018
@ryansb ryansb added needs_triage Needs a first human triage before being processed. and removed needs_triage Needs a first human triage before being processed. labels Aug 28, 2018
@ansibot ansibot added the files Files category label Mar 5, 2019
mkrizek added a commit to mkrizek/ansible that referenced this issue Mar 21, 2019
@mkrizek mkrizek added the has_pr This issue has an associated PR. label Mar 21, 2019
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. files Files category has_pr This issue has an associated PR. module This issue/PR relates to a module. python3 support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants