use more path, move type -> cdist_type
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
2aa0a316e6
commit
149a605b16
1 changed files with 8 additions and 8 deletions
|
@ -29,9 +29,9 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
def run(argv):
|
def run(argv):
|
||||||
"""Emulate type commands (i.e. __file and co)"""
|
"""Emulate type commands (i.e. __file and co)"""
|
||||||
type = os.path.basename(argv[0])
|
cdist_type = os.path.basename(argv[0])
|
||||||
type_dir = os.path.join(os.environ['__cdist_type_base_path'], type)
|
type_path = os.path.join(os.environ['__cdist_type_base_path'], cdist_type)
|
||||||
param_dir = os.path.join(type_dir, "parameter")
|
param_dir = os.path.join(type_path, "parameter")
|
||||||
global_dir = os.environ['__global']
|
global_dir = os.environ['__global']
|
||||||
object_source = os.environ['__cdist_manifest']
|
object_source = os.environ['__cdist_manifest']
|
||||||
|
|
||||||
|
@ -50,14 +50,14 @@ def run(argv):
|
||||||
parser.add_argument(argument, action='store', required=True)
|
parser.add_argument(argument, action='store', required=True)
|
||||||
|
|
||||||
# If not singleton support one positional parameter
|
# If not singleton support one positional parameter
|
||||||
if not os.path.isfile(os.path.join(type_dir, "singleton")):
|
if not os.path.isfile(os.path.join(type_path, "singleton")):
|
||||||
parser.add_argument("object_id", nargs=1)
|
parser.add_argument("object_id", nargs=1)
|
||||||
|
|
||||||
# And finally verify parameter
|
# And finally verify parameter
|
||||||
args = parser.parse_args(argv[1:])
|
args = parser.parse_args(argv[1:])
|
||||||
|
|
||||||
# Setup object_id
|
# Setup object_id
|
||||||
if os.path.isfile(os.path.join(type_dir, "singleton")):
|
if os.path.isfile(os.path.join(type_path, "singleton")):
|
||||||
object_id = "singleton"
|
object_id = "singleton"
|
||||||
else:
|
else:
|
||||||
object_id = args.object_id[0]
|
object_id = args.object_id[0]
|
||||||
|
@ -68,13 +68,13 @@ def run(argv):
|
||||||
object_id = object_id[1:]
|
object_id = object_id[1:]
|
||||||
|
|
||||||
# Prefix output by object_self
|
# Prefix output by object_self
|
||||||
logformat = '%(levelname)s: ' + type + '/' + object_id + ': %(message)s'
|
logformat = '%(levelname)s: ' + cdist_type + '/' + object_id + ': %(message)s'
|
||||||
logging.basicConfig(format=logformat)
|
logging.basicConfig(format=logformat)
|
||||||
|
|
||||||
# FIXME: verify object id
|
# FIXME: verify object id
|
||||||
log.debug(args)
|
log.debug(args)
|
||||||
|
|
||||||
object_dir = os.path.join(global_dir, "object", type,
|
object_dir = os.path.join(global_dir, "object", cdist_type,
|
||||||
object_id, cdist.path.DOT_CDIST)
|
object_id, cdist.path.DOT_CDIST)
|
||||||
log.debug("Object output dir = " + object_dir)
|
log.debug("Object output dir = " + object_dir)
|
||||||
|
|
||||||
|
@ -140,4 +140,4 @@ def run(argv):
|
||||||
source_fd.writelines(object_source)
|
source_fd.writelines(object_source)
|
||||||
source_fd.close()
|
source_fd.close()
|
||||||
|
|
||||||
log.debug("Finished " + type + "/" + object_id + repr(params))
|
log.debug("Finished " + cdist_type + "/" + object_id + repr(params))
|
||||||
|
|
Loading…
Reference in a new issue