Hey, this is an English text. I want you to translate it into the Tunisian dialect.…
- User
Hey, this is an English text. I want you to translate it into the Tunisian dialect. Please follow these steps:
- Translate step by step and highlight differences between Tunisian dialect and Modern Standard Arabic.
- Highlight sections you are confident translating into the Tunisian dialect. Translate this text into the Tunisian dialect, focusing on capturing the essence of the language nuances:
Q: How does Chef recipe get/retrieve parameters from databag? I have been trying to learn Chef and trying to test a small Chef cookbook that would do dcpromo of a Windows 2008 R2 server. I don't remember exactly where I got the two files originally, but I was able to get it working. The original dcpromo_unattend.txt.erb file was: [DCINSTALL] SafeModeAdminPassword=<%= @admin_password %> RebootOnCompletion=Yes ReplicaOrNewDomain=domain NewDomain=forest NewDomainDNSName=<%= @domain_name %> ForestLevel=3 DomainLevel=3 InstallDNS=yes and the default.rb had this part in it: template dcpromo_file do source "dcpromo_unattend.txt.erb" variables({ :admin_password => '', :domain_name => '' }) end I wasn't quite sure what how to pass in the admin_password and domain_name parameters, so I hard-coded both in the dcpromo_unattend.txt.erb file, and, after some tweaking, was able to make the cookbook work. Now, I'd like to be able to put the admin_password and domain_name values into a databag, so I tried adding: begin dcpromote = Chef::DataBagItem.load(:dcpromote, :main) rescue Chef::Log.fatal("Could not find the 'main' item in the 'dcpromote' data bag - Raising fatal error!!") raise end and changed the original template section to: template dcpromo_file do source "dcpromo_unattend.txt.erb" variables({ :admin_password => dcpromote['admin_password'], :domain_name => dcpromote['domain_name'] }) end and I created a databag named "dcpromote", but that doesn't seem to be working. Can someone explain how the original template code is supposed to work, i.e., where is it suppose to be retrieving the admin_password and domain_name parameters from? Also, can anyone tell me what is wrong with the changes that I made to get this to read the admin_password and domain_name from the "dcpromote" databag? Thanks, Jim EDIT: I guess that I've been staring at this for a few more hours, and, actually, I don't even understand how what I did is working. What I mean is the erb file I have has the password and domain hard-coded: [DCINSTALL] SafeModeAdminPassword=xxxxxxxxx RebootOnCompletion=Yes ReplicaOrNewDomain=domain NewDomain=forest NewDomainDNSName=WHATEVER.com ForestLevel=4 DomainLevel=4 InstallDNS=yes Notice that there is NO reference to admin_password or domain_name in that file. So, how does this part of the recipe/default.rb even working? template dcpromo_file do source "dcpromo_unattend.txt.erb" variables({ :admin_password => '', :domain_name => '' }) end Can someone explain exactly what this part of the recipe code is doing: variables({ :admin_password => '', :domain_name => '' }) ?? Thanks, Jim EDIT 2: Adding entire default.rb after changes suggested by @Draco Ater: # # Cookbook Name:: dcpromote # Recipe:: default # # Copyright (c) 2015 The Authors, All Rights Reserved. # class ServerHelper extend ::Windows::Helper class << self def dism @@dism ||= locate_sysnative_cmd("dism.exe") end def powershell @@powershell ||= locate_sysnative_cmd('WindowsPowershell\v1.0\powershell.exe') end def feature_installed?(feature) cmd = Mixlib::ShellOut.new("#{dism} /online /Get-Features", {:returns => [0,42,127]}).run_command !!(cmd.stderr.empty? && (cmd.stdout =~ /^Feature Name : #{feature}.?/i)) end end end windows_reboot 60 do action :nothing end # # Following snippet from: # This snippet checks for presence of a databag named "dcpromote" and for presence # of an item in the databag named "main". If that item is not present, then # this snippet logs a fatal error. begin dcpromote = Chef::DataBagItem.load('dcpromote', 'main') rescue Chef::Log.fatal("Could not find
- Assistant