LFCS · Question #217
LFCS Question #217: Real Exam Question with Answer & Explanation
The correct answer is D: isa should be include.. The Puppet configuration has a syntax error because it uses isa to include a class in a node definition, where the correct keyword should be include.
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.
Explanation
The Puppet configuration has a syntax error because it uses isa to include a class in a node definition, where the correct keyword should be include.
Common mistakes.
- A. Comments in Puppet correctly begin with a hash symbol (#), as shown in the example, so this is not a syntax error.
- B. In Puppet resource declarations, a colon (:) correctly separates the resource title from its attribute list, such as
"/tmp/test.txt":, so a semicolon (;) would be incorrect here. - C. Class, node, and resource definitions in Puppet use curly braces ({}) for block delimitation and do not require semicolons (;) at the end of their definitions.
Concept tested. Puppet class inclusion syntax
Reference. https://www.puppet.com/docs/puppet/7/lang_classes.html
Topics
Community Discussion
No community discussion yet for this question.