Add derived env vars for target hostname and fqdn.

This commit is contained in:
Darko Poljak 2016-08-10 23:56:56 +02:00
commit dbcc94ab65
23 changed files with 181 additions and 59 deletions

View file

@ -36,6 +36,9 @@ common:
env:
PATH: prepend directory with type emulator symlinks == local.bin_path
__target_host: the target host we are working on
__target_hostname: the target hostname provided from __target_host
__target_fqdn: the target's fully qualified domain name provided from
__target_host
__cdist_manifest: full qualified path of the manifest == script
__cdist_type_base_path: full qualified path to the directory where
types are defined for use in type emulator
@ -46,6 +49,9 @@ gencode-local
env:
__target_host: the target host we are working on
__target_hostname: the target hostname provided from __target_host
__target_fqdn: the target's fully qualified domain name provided from
__target_host
__global: full qualified path to the global
output dir == local.out_path
__object: full qualified path to the object's dir
@ -61,6 +67,9 @@ gencode-remote
env:
__target_host: the target host we are working on
__target_hostname: the target hostname provided from __target_host
__target_fqdn: the target's fully qualified domain name provided from
__target_host
__global: full qualified path to the global
output dir == local.out_path
__object: full qualified path to the object's dir
@ -89,12 +98,17 @@ class Code(object):
"""Generates and executes cdist code scripts.
"""
# target_host is tuple (target_host, target_hostname, target_fqdn)
def __init__(self, target_host, local, remote):
self.target_host = target_host
self.target_host = target_host[0]
self.target_hostname = target_host[1]
self.target_fqdn = target_host[2]
self.local = local
self.remote = remote
self.env = {
'__target_host': self.target_host,
'__target_host': self.target_host[0],
'__target_hostname': self.target_host[1],
'__target_fqdn': self.target_host[2],
'__global': self.local.base_path,
'__files': self.local.files_path,
}

View file

@ -68,12 +68,14 @@ class Explorer(object):
def __init__(self, target_host, local, remote):
self.target_host = target_host
self.log = logging.getLogger(target_host)
self.log = logging.getLogger(target_host[0])
self.local = local
self.remote = remote
self.env = {
'__target_host': self.target_host,
'__target_host': self.target_host[0],
'__target_hostname': self.target_host[1],
'__target_fqdn': self.target_host[2],
'__explorer': self.remote.global_explorer_path,
}
self._type_explorers_transferred = []

View file

@ -32,6 +32,9 @@ common:
env:
PATH: prepend directory with type emulator symlinks == local.bin_path
__target_host: the target host we are working on
__target_hostname: the target hostname provided from __target_host
__target_fqdn: the target's fully qualified domain name provided from
__target_host
__global: full qualified path to the global
output dir == local.out_path
__cdist_manifest: full qualified path of the manifest == script
@ -95,14 +98,16 @@ class Manifest(object):
self.target_host = target_host
self.local = local
self.log = logging.getLogger(self.target_host)
self.log = logging.getLogger(self.target_host[0])
self.env = {
'PATH': "%s:%s" % (self.local.bin_path, os.environ['PATH']),
# for use in type emulator
'__cdist_type_base_path': self.local.type_path,
'__global': self.local.base_path,
'__target_host': self.target_host,
'__target_host': self.target_host[0],
'__target_hostname': self.target_host[1],
'__target_fqdn': self.target_host[2],
'__files': self.local.files_path,
}