1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Mirantis Inc., Enea AB and others.
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Mon, 21 Aug 2017 02:03:01 +0200
11 Subject: [PATCH] seedng: module: Sync salt version
13 salt custom py module seedng.py should use the same Salt version
14 when preinstalling minion for salt-controlled VMs via bootstrap
17 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
20 diff --git a/_modules/seedng.py b/_modules/seedng.py
21 --- a/_modules/seedng.py
22 +++ b/_modules/seedng.py
24 boot_, tmppath = (prep_bootstrap(mpt)
25 or salt.syspaths.BOOTSTRAP)
26 # Exec the chroot command
27 + arg = 'stable {0}'.format('.'.join(salt.version.__version__.split('.')[:2]))
28 cmd = 'if type salt-minion; then exit 0; '
29 - cmd += 'else sh {0} -c /tmp; fi'.format(os.path.join(tmppath, 'bootstrap-salt.sh'))
30 + cmd += 'else sh {0} -c /tmp {1}; fi'.format(
31 + os.path.join(tmppath, 'bootstrap-salt.sh'), arg)
32 return not __salt__['cmd.run_chroot'](mpt, cmd, python_shell=True)['retcode']