def operation(ctx, **kwargs): op = _extract_op(ctx) props = ctx.properties['puppet_config'] mgr = PuppetManager(ctx) # print(mgr, isinstance(mgr, PuppetStandaloneRunner)) tags = _prepare_tags(ctx, props, op) if isinstance(mgr, PuppetAgentRunner): if op != 'start' and tags is None: ctx.logger.info("No tags specific to operation '{0}', skipping". format(op)) return mgr.run(tags=(tags or [])) return if isinstance(mgr, PuppetStandaloneRunner): e = _op_specifc(ctx, props, op, 'execute') m = _op_specifc(ctx, props, op, 'manifest') if e and m: raise RuntimeError("Either 'execute' or 'manifest' " + "must be specified for given operation. " + "Both are specified for operation {0}".format( op)) if e or m: mgr.run(tags=(tags or []), execute=e, manifest=m) return raise RuntimeError("Internal error: unknown Puppet Runner")
def operation(ctx, **kwargs): op = _extract_op(ctx) props = ctx.node.properties['puppet_config'] mgr = PuppetManager(ctx) # print(mgr, isinstance(mgr, PuppetStandaloneRunner)) tags = _prepare_tags(ctx, props, op) if isinstance(mgr, PuppetAgentRunner): if op != 'start' and tags is None: ctx.logger.info( "No tags specific to operation '{0}', skipping".format(op)) return mgr.run(tags=(tags or [])) return if isinstance(mgr, PuppetStandaloneRunner): e = _op_specifc(ctx, props, op, 'execute') m = _op_specifc(ctx, props, op, 'manifest') if e and m: raise RuntimeError( "Either 'execute' or 'manifest' " + "must be specified for given operation. " + "Both are specified for operation {0}".format(op)) if e or m: mgr.run(tags=(tags or []), execute=e, manifest=m) return raise RuntimeError("Internal error: unknown Puppet Runner")
def operation(ctx, **kwargs): op = _extract_op(ctx) props = ctx.properties['puppet_config'] mgr = PuppetManager(ctx) # print(mgr, isinstance(mgr, PuppetStandaloneRunner)) tags = _prepare_tags(ctx, props, op) if isinstance(mgr, PuppetAgentRunner): if op != 'start' and tags is None: ctx.logger.info( "No tags specific to operation '{0}', skipping".format(op)) return mgr.run(tags=(tags or [])) if op == 'configure': # mgr.run() is called once before this on the 'configure' operation # that allows for the puppet.conf to be set and ssl certs to be retrieved # classify classifier = PuppetClassifier(ctx) classifier.classify() # mgr.run() will be called again on the 'start' operation # then node will be configured according to the classification just done return if isinstance(mgr, PuppetStandaloneRunner): e = _op_specifc(ctx, props, op, 'execute') m = _op_specifc(ctx, props, op, 'manifest') if e and m: raise RuntimeError( "Either 'execute' or 'manifest' " + "must be specified for given operation. " + "Both are specified for operation {0}".format(op)) if e or m: mgr.run(tags=(tags or []), execute=e, manifest=m) return raise RuntimeError("Internal error: unknown Puppet Runner")
def operation(ctx, **kwargs): op = _extract_op(ctx) props = ctx.properties['puppet_config'] mgr = PuppetManager(ctx) # print(mgr, isinstance(mgr, PuppetStandaloneRunner)) tags = _prepare_tags(ctx, props, op) if isinstance(mgr, PuppetAgentRunner): if op != 'start' and tags is None: ctx.logger.info("No tags specific to operation '{0}', skipping". format(op)) return mgr.run(tags=(tags or [])) if op == 'configure': # mgr.run() is called once before this on the 'configure' operation # that allows for the puppet.conf to be set and ssl certs to be retrieved # classify classifier = PuppetClassifier(ctx) classifier.classify() # mgr.run() will be called again on the 'start' operation # then node will be configured according to the classification just done return if isinstance(mgr, PuppetStandaloneRunner): e = _op_specifc(ctx, props, op, 'execute') m = _op_specifc(ctx, props, op, 'manifest') if e and m: raise RuntimeError("Either 'execute' or 'manifest' " + "must be specified for given operation. " + "Both are specified for operation {0}".format( op)) if e or m: mgr.run(tags=(tags or []), execute=e, manifest=m) return raise RuntimeError("Internal error: unknown Puppet Runner")