summaryrefslogtreecommitdiff
path: root/lib/chef/util/dsc
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /lib/chef/util/dsc
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
Diffstat (limited to 'lib/chef/util/dsc')
-rw-r--r--lib/chef/util/dsc/configuration_generator.rb12
-rw-r--r--lib/chef/util/dsc/lcm_output_parser.rb8
-rw-r--r--lib/chef/util/dsc/local_configuration_manager.rb14
-rw-r--r--lib/chef/util/dsc/resource_store.rb14
4 files changed, 24 insertions, 24 deletions
diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb
index 2041278e4a..e2c09aeea8 100644
--- a/lib/chef/util/dsc/configuration_generator.rb
+++ b/lib/chef/util/dsc/configuration_generator.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
+require "chef/util/powershell/cmdlet"
class Chef::Util::DSC
class ConfigurationGenerator
@@ -27,9 +27,9 @@ class Chef::Util::DSC
def configuration_document_from_script_code(code, configuration_flags, imports, shellout_flags)
Chef::Log.debug("DSC: DSC code:\n '#{code}'")
- generated_script_path = write_document_generation_script(code, 'chef_dsc', imports)
+ generated_script_path = write_document_generation_script(code, "chef_dsc", imports)
begin
- configuration_document_from_script_path(generated_script_path, 'chef_dsc', configuration_flags, shellout_flags)
+ configuration_document_from_script_path(generated_script_path, "chef_dsc", configuration_flags, shellout_flags)
ensure
::FileUtils.rm(generated_script_path)
end
@@ -97,7 +97,7 @@ Configuration '#{configuration_name}'
def generate_import_resource_statements(imports)
if imports
imports.map do |resource_module, resources|
- if resources.length == 0 || resources.include?('*')
+ if resources.length == 0 || resources.include?("*")
"Import-DscResource -ModuleName #{resource_module}"
else
"Import-DscResource -ModuleName #{resource_module} -Name #{resources.join(',')}"
@@ -114,7 +114,7 @@ Configuration '#{configuration_name}'
def write_document_generation_script(code, configuration_name, imports)
script_path = "#{@config_directory}/chef_dsc_config.ps1"
- ::File.open(script_path, 'wt') do | script |
+ ::File.open(script_path, "wt") do | script |
script.write(configuration_code(code, configuration_name, imports))
end
script_path
@@ -131,7 +131,7 @@ Configuration '#{configuration_name}'
end
def get_configuration_document(document_path)
- ::File.open(document_path, 'rb') do | file |
+ ::File.open(document_path, "rb") do | file |
file.read
end
end
diff --git a/lib/chef/util/dsc/lcm_output_parser.rb b/lib/chef/util/dsc/lcm_output_parser.rb
index 754fde3e8b..ac847adffa 100644
--- a/lib/chef/util/dsc/lcm_output_parser.rb
+++ b/lib/chef/util/dsc/lcm_output_parser.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/log'
-require 'chef/util/dsc/resource_info'
-require 'chef/exceptions'
+require "chef/log"
+require "chef/util/dsc/resource_info"
+require "chef/exceptions"
class Chef
class Util
@@ -109,7 +109,7 @@ class Chef
# What If: [machinename]: LCM: [op_action op_type] message
# extract op_action, op_type, and message
operation, info = match.captures
- op_action, op_type = operation.strip.split(' ').map {|m| m.downcase.to_sym}
+ op_action, op_type = operation.strip.split(" ").map {|m| m.downcase.to_sym}
else
op_action = op_type = :info
if match = line.match(/^.*?:.*?: \s+(.*)/)
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb
index f8398341e5..deaa83ef09 100644
--- a/lib/chef/util/dsc/local_configuration_manager.rb
+++ b/lib/chef/util/dsc/local_configuration_manager.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/dsc/lcm_output_parser'
+require "chef/util/powershell/cmdlet"
+require "chef/util/dsc/lcm_output_parser"
class Chef::Util::DSC
class LocalConfigurationManager
@@ -47,7 +47,7 @@ class Chef::Util::DSC
def run_configuration_cmdlet(configuration_document, apply_configuration, shellout_flags)
Chef::Log.debug("DSC: Calling DSC Local Config Manager to #{apply_configuration ? "set" : "test"} configuration document.")
- test_only_parameters = ! apply_configuration ? '-whatif; if (! $?) { exit 1 }' : ''
+ test_only_parameters = ! apply_configuration ? "-whatif; if (! $?) { exit 1 }" : ""
start_operation_timing
command_code = lcm_command_code(@configuration_path, test_only_parameters)
@@ -90,7 +90,7 @@ EOH
end
def whatif_not_supported?(what_if_exception_output)
- !! (what_if_exception_output.gsub(/[\r\n]+/, '').gsub(/\s+/, ' ') =~ /A parameter cannot be found that matches parameter name 'Whatif'/i)
+ !! (what_if_exception_output.gsub(/[\r\n]+/, "").gsub(/\s+/, " ") =~ /A parameter cannot be found that matches parameter name 'Whatif'/i)
end
def dsc_module_import_failure?(what_if_output)
@@ -105,13 +105,13 @@ EOH
Parser::parse(what_if_output)
rescue Chef::Exceptions::LCMParser => e
Chef::Log::warn("Could not parse LCM output: #{e}")
- [Chef::Util::DSC::ResourceInfo.new('Unknown DSC Resources', true, ['Unknown changes because LCM output was not parsable.'])]
+ [Chef::Util::DSC::ResourceInfo.new("Unknown DSC Resources", true, ["Unknown changes because LCM output was not parsable."])]
end
end
def save_configuration_document(configuration_document)
::FileUtils.mkdir_p(@configuration_path)
- ::File.open(configuration_document_path, 'wb') do | file |
+ ::File.open(configuration_document_path, "wb") do | file |
file.write(configuration_document)
end
end
@@ -121,7 +121,7 @@ EOH
end
def configuration_document_path
- File.join(@configuration_path,'..mof')
+ File.join(@configuration_path,"..mof")
end
def clear_execution_time
diff --git a/lib/chef/util/dsc/resource_store.rb b/lib/chef/util/dsc/resource_store.rb
index fdcecc2b3c..761ade9989 100644
--- a/lib/chef/util/dsc/resource_store.rb
+++ b/lib/chef/util/dsc/resource_store.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'chef/util/powershell/cmdlet'
-require 'chef/util/powershell/cmdlet_result'
-require 'chef/exceptions'
+require "chef/util/powershell/cmdlet"
+require "chef/util/powershell/cmdlet_result"
+require "chef/exceptions"
class Chef
class Util
@@ -53,7 +53,7 @@ class DSC
def add_resource(new_r)
count = resources.count do |r|
- r['ResourceType'].casecmp(new_r['ResourceType']) == 0
+ r["ResourceType"].casecmp(new_r["ResourceType"]) == 0
end
if count == 0
resources << new_r
@@ -72,9 +72,9 @@ class DSC
def find_resources(name, module_name, rs)
found = rs.find_all do |r|
- name_matches = r['Name'].casecmp(name) == 0
+ name_matches = r["Name"].casecmp(name) == 0
if name_matches
- module_name == nil || (r['Module'] and r['Module']['Name'].casecmp(module_name) == 0)
+ module_name == nil || (r["Module"] and r["Module"]["Name"].casecmp(module_name) == 0)
else
false
end
@@ -84,7 +84,7 @@ class DSC
# Returns a list of dsc resources
def query_resources
- cmdlet = Chef::Util::Powershell::Cmdlet.new(nil, 'get-dscresource',
+ cmdlet = Chef::Util::Powershell::Cmdlet.new(nil, "get-dscresource",
:object)
result = cmdlet.run
result.return_value