瀏覽代碼

Fix linux_enforce_hostname for test env

* Add TODO-proper fix for state - native salt fun.
   But due bug[1] in saltstack - we can't enable
   proper solution now

[1] 74599bbdfc

Related-PROD: PROD-20730

Change-Id: I11b6d81ae0f9a7864518f638e8fc423e4e087285
pull/165/head
azvyagintsev 6 年之前
父節點
當前提交
b7c2ef4b57
共有 4 個檔案被更改,包括 23 行新增14 行删除
  1. +2
    -2
      .kitchen.yml
  2. +14
    -10
      linux/network/hostname.sls
  3. +2
    -0
      linux/network/init.sls
  4. +5
    -2
      tests/pillar/system.sls

+ 2
- 2
.kitchen.yml 查看文件

@@ -1,8 +1,8 @@
---
driver:
name: docker
hostname: linux.ci.local
use_sudo: false
hostname: linux-formula
run_options: -v /dev/log:/dev/log:ro

provisioner:
name: salt_solo

+ 14
- 10
linux/network/hostname.sls 查看文件

@@ -16,18 +16,22 @@ linux_hostname_file:

{%- endif %}

{# Change state to proper one, after releasing patch:
https://github.com/saltstack/salt/pull/45748/files/74599bbdfcf99f45d3a31296887097fade31cbf1
linux_enforce_hostname:
cmd.wait:
network.system:
- enabled: True
- hostname: {{ network.hostname }}
- apply_hostname: True
- retain_settings: True
#}

linux_enforce_hostname:
cmd.run:
- name: hostname {{ network.hostname }}
- unless: test "$(hostname)" = "{{ network.hostname }}"

{#
linux_hostname_hosts:
host.present:
- ip: {{ grains.ip4_interfaces[network.get('default_interface', 'eth0')][0] }}
- names:
- {{ network.fqdn }}
- {{ network.hostname }}
#}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}

{%- endif %}

+ 2
- 0
linux/network/init.sls 查看文件

@@ -1,6 +1,8 @@
{%- from "linux/map.jinja" import network with context %}
include:
{%- if network.hostname is defined %}
- linux.network.hostname
{%- endif %}
{%- if network.host|length > 0 or network.get('purge_hosts', True) %}
- linux.network.host
{%- endif %}

+ 5
- 2
tests/pillar/system.sls 查看文件

@@ -1,11 +1,14 @@
linux:
network:
enabled: true
hostname: linux
fqdn: linux.ci.local
system:
enabled: true
cluster: default
name: linux
domain: local
domain: ci.local
environment: prd
hostname: system.pillar.local
purge_repos: true
directory:
/tmp/test:

Loading…
取消
儲存