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.
Question
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)- A7% (2)
- B17% (5)
- C3% (1)
- D73% (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.
Puppet uses the '#' character for single-line comments, which is correctly used in the provided configuration.
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.
Puppet class, node, and resource definitions are typically terminated by curly braces '{}' and do not require a semicolon ';'.
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
Community Discussion
No community discussion yet for this question.