nerdexam
CompTIA

LX0-104 · Question #217

What is the syntax error in the following simple Puppet configuration file? class test_class { file { "/tmp/test.txt": mode => 600, owner => root, group => root } } # Define the node node testclient {

The correct answer is D. isa should be include.. The Puppet configuration file contains a syntax error because it uses 'isa' instead of the correct keyword for including a class in a node definition.

Administrative Tasks

Question

What is the syntax error in the following simple Puppet configuration file? class test_class { file { "/tmp/test.txt": mode => 600, owner => root, group => root } } # Define the node node testclient { isa test_class }

Options

  • AComments begin with // character and not a #.
  • BThe colon (:) after /tmp/test.txt should be a semicolon (;).
  • Cclass, node and file sections require a semicolon (;) at the end of their definitions.
  • Disa should be include.

How the community answered

(30 responses)
  • A
    7% (2)
  • B
    17% (5)
  • C
    3% (1)
  • D
    73% (22)

Why each option

The Puppet configuration file contains a syntax error because it uses 'isa' instead of the correct keyword for including a class in a node definition.

AComments begin with // character and not a #.

Puppet uses the '#' character for single-line comments, which is correctly used in the provided configuration.

BThe colon (:) after /tmp/test.txt should be a semicolon (;).

The colon ':' after a resource title like '/tmp/test.txt' is the correct syntax in Puppet resource declarations to separate the title from its attributes.

Cclass, node and file sections require a semicolon (;) at the end of their definitions.

Puppet class, node, and resource definitions are typically terminated by curly braces '{}' and do not require a semicolon ';'.

Disa should be include.Correct

In Puppet, the 'include' keyword is used within a node definition or another class to incorporate the resources and logic defined in a class. The term 'isa' is not a valid Puppet language construct for this purpose and will result in a syntax error.

Concept tested: Puppet class inclusion syntax

Source: https://www.puppet.com/docs/puppet/7/lang_classes.html#including-classes

Topics

#Puppet#syntax error#node definition#class inclusion

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice