Browse Source

Deleting deprecated function and switch test to 2017.7

The patch deletes deprecated cmd.run function which actually
was defined in salt 2016 as alias for cmd.shell therefore this
change supports backward compatibility.

Change-Id: I47eae0b8ee45ca1a1a9b3e8e544c893614573fda
Related-PROD: 17056
pull/73/head
Oleh Hryhorov 6 years ago
parent
commit
7c5dfd3616
4 changed files with 17 additions and 6 deletions
  1. +1
    -1
      .kitchen.yml
  2. +11
    -0
      .travis.yml
  3. +4
    -4
      _modules/virtng.py
  4. +1
    -1
      salt/files/orchestrate.sls

+ 1
- 1
.kitchen.yml View File

name: salt_solo name: salt_solo
salt_install: bootstrap salt_install: bootstrap
salt_bootstrap_url: https://bootstrap.saltstack.com salt_bootstrap_url: https://bootstrap.saltstack.com
salt_version: latest
salt_version: <%=ENV['SALT_VERSION'] || 'latest'%>
salt_minion_id: salt.ci.local salt_minion_id: salt.ci.local
require_chef: false require_chef: false
log_level: error log_level: error

+ 11
- 0
.travis.yml View File



env: env:


- PLATFORM=trevorj/salty-whales:trusty-2017.7 SUITE=control-default
- PLATFORM=trevorj/salty-whales:trusty-2017.7 SUITE=master-default
- PLATFORM=trevorj/salty-whales:trusty-2017.7 SUITE=minion-default
- PLATFORM=trevorj/salty-whales:trusty-2017.7 SUITE=minion-multi-master-failover
- PLATFORM=trevorj/salty-whales:xenial-2017.7 SUITE=control-default
- PLATFORM=trevorj/salty-whales:xenial-2017.7 SUITE=master-default
- PLATFORM=trevorj/salty-whales:xenial-2017.7 SUITE=minion-default
- PLATFORM=trevorj/salty-whales:xenial-2017.7 SUITE=minion-multi-master-failover
# TODO, once 18.04 LTS Bionic Beaver is released, rename trusty to bionic
- PLATFORM=trevorj/salty-whales:bionic-2017.7 SUITE=master-default
- PLATFORM=trevorj/salty-whales:bionic-2017.7 SUITE=minion-default
- PLATFORM=trevorj/salty-whales:trusty SUITE=control-default - PLATFORM=trevorj/salty-whales:trusty SUITE=control-default
- PLATFORM=trevorj/salty-whales:trusty SUITE=master-default - PLATFORM=trevorj/salty-whales:trusty SUITE=master-default
- PLATFORM=trevorj/salty-whales:trusty SUITE=minion-default - PLATFORM=trevorj/salty-whales:trusty SUITE=minion-default

+ 4
- 4
_modules/virtng.py View File

Detect information for the image at path Detect information for the image at path
''' '''
ret = {} ret = {}
out = __salt__['cmd.run']('qemu-img info {0}'.format(path))
out = __salt__['cmd.shell']('qemu-img info {0}'.format(path))


match_map = {'size': r'virtual size: \w+ \((\d+) byte[s]?\)', match_map = {'size': r'virtual size: \w+ \((\d+) byte[s]?\)',
'format': r'file format: (\w+)'} 'format': r'file format: (\w+)'}
''' '''
Detect what driver needs to be used for the given image Detect what driver needs to be used for the given image
''' '''
out = __salt__['cmd.run']('qemu-img info {0}'.format(vda))
out = __salt__['cmd.shell']('qemu-img info {0}'.format(vda))
if 'file format: qcow2' in out: if 'file format: qcow2' in out:
return 'qcow2' return 'qcow2'
else: else:
except IOError: except IOError:
# No /proc/modules? Are we on Windows? Or Solaris? # No /proc/modules? Are we on Windows? Or Solaris?
return False return False
return 'libvirtd' in __salt__['cmd.run'](__grains__['ps'])
return 'libvirtd' in __salt__['cmd.shell'](__grains__['ps'])




def is_xen_hyper(): def is_xen_hyper():
except IOError: except IOError:
# No /proc/modules? Are we on Windows? Or Solaris? # No /proc/modules? Are we on Windows? Or Solaris?
return False return False
return 'libvirtd' in __salt__['cmd.run'](__grains__['ps'])
return 'libvirtd' in __salt__['cmd.shell'](__grains__['ps'])




def is_hyper(): def is_hyper():

+ 1
- 1
salt/files/orchestrate.sls View File



{%- if salt['file.directory_exists']('/srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate') and formula|length > 1 and salt['file.file_exists']('/srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate/'+formula.1+'.sls') %} {%- if salt['file.directory_exists']('/srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate') and formula|length > 1 and salt['file.file_exists']('/srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate/'+formula.1+'.sls') %}


{{ salt['cmd.run']('cat /srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate/'+formula.1+'.sls') }}
{{ salt['cmd.shell']('cat /srv/salt/env/'+environment_name+'/'+formula.0+'/orchestrate/'+formula.1+'.sls') }}


{%- else %} {%- else %}
{%- if args[ state.0 ] is defined %} {%- if args[ state.0 ] is defined %}

Loading…
Cancel
Save