salt: blockreplace marker_end isn't applied with newline

Description of Issue/Question

blockreplace marker_end isn’t applied with newline like #33686

Setup

Using apache-formula there is missing newline in the resulting file before the end mark example

# START managed zone -DO-NOT-EDIT-
ServerSignature off
TraceEnable off
FileETag None
ServerTokens Prod# END managed zone --

{% if salt['file.file_exists' ]('/etc/apache2/conf-available/security.conf') %}
apache_security-block:
  file.blockreplace:
    - name: /etc/apache2/conf-available/security.conf
    - marker_start: "# START managed zone -DO-NOT-EDIT-"
    - marker_end: "# END managed zone --"
    - append_if_not_found: True
    - show_changes: True
    - require:
      - pkg: apache
    - watch_in:
      - module: apache-reload

{% for option, value in salt['pillar.get']('apache:security', {}).items() %}
apache_manage-security-{{ option }}:
  file.accumulated:
    - filename: /etc/apache2/conf-available/security.conf
    - name: apache_manage-security-add-{{ option }}
    - text: "{{ option }} {{ value }}"
    - require_in:
      - file: apache_security-block
{% endfor %}

Steps to Reproduce Issue

Configure security parameter in apache-formula

Versions Report

Salt Version: Salt: 2017.7.2

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.4.2 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed ioflo: Not Installed Jinja2: 2.8 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.3 msgpack-pure: Not Installed msgpack-python: 0.4.6 mysql-python: Not Installed pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed Python: 2.7.12 (default, Nov 19 2016, 06:48:10) python-gnupg: Not Installed PyYAML: 3.11 PyZMQ: 15.2.0 RAET: Not Installed smmap: Not Installed timelib: Not Installed Tornado: 4.2.1 ZMQ: 4.1.4

System Versions: dist: Ubuntu 16.04 xenial locale: UTF-8 machine: x86_64 release: 4.4.0-89-generic system: Linux version: Ubuntu 16.04 xenial

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

I think that makes a lot of sense and I agree with your assessment. The only thing I would add is to make sure there will be the appropriate documentation/warnings that the default behavior will change in Fluorine.

Yes, this is annoying, I think it just got lost in the fray. We should look into this, and it should be an easy fix