I have following inside a recipe.
execute 'disable-all-yum-repos-centos' do
command 'yum-config-manager --disable "*"'
action :run
only_if { centos? }
end
Now, what does this { centos? } means here, is it a variable being called? or some inbuilt function, as i learned,variables are called like node[variable name] or #{ node[variable name]} if inside a string,this above mentioned thing is new for me,help me to understand.
I understand that it's checking if the os is centos, but, what is this syntax? and how this is evaluated.
It is a function call enclosed in a block. If you drop the block, Chef will call system command, you can see more examples in the documentation.
It looks like your code is using chef-sugar cookbook, centos?
method is defined here.