Skip to content

Commit a526e74

Browse files
committed
Merge pull request #14 from Appdynamics/fix/dotnet-cleanup
Cleanup .NET recipe.
2 parents 2480156 + 8c942f4 commit a526e74

File tree

2 files changed

+24
-73
lines changed

2 files changed

+24
-73
lines changed

attributes/dotnet_agent.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default['appdynamics']['dotnet_agent']['version'] = 'latest'
2-
default['appdynamics']['dotnet_agent']['source'] = "http://localhost/AppdynamicsInstallers/" #'https://packages.appdynamics.com/machine/%{version}/JavaAppAgent.zip'
2+
default['appdynamics']['dotnet_agent']['source'] = 'http://localhost/AppdynamicsInstallers/' #'https://packages.appdynamics.com/machine/%{version}/JavaAppAgent.zip'
33
default['appdynamics']['dotnet_agent']['checksum'] = '7acb3756147a1d5a13c49b107a890ea56a8eb4099fd793e498e34b6f0b5962dc' #nil
44
default['appdynamics']['dotnet_agent']['install_dir'] = 'C:\Program Files\Appdynamics'
55
default['appdynamics']['dotnet_agent']['logfiles_dir'] = 'C:\DotNetAgent\Logs'

recipes/dotnet_agent.rb

Lines changed: 23 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,23 @@
11
agent = node['appdynamics']['dotnet_agent']
22
controller = node['appdynamics']['controller']
3-
proxy = node['appdynamics']['http_proxy']
4-
bitness = node['kernel']['os_info']['os_architecture']
3+
proxy = node['appdynamics']['http_proxy']
54
install_directory = agent['install_dir']
65
system_directory = node['kernel']['os_info']['windows_directory']
76

8-
agent_msi = ""
9-
##################################################################################################################################
10-
# The below paths can also be used instead of temp direcotry. But there will be msiexec exceptions if there is space in the path #
11-
# agent_msi_path = "#{Chef::Config[:file_cache_path]" #
12-
# setup_config = "#{Chef::Config[:file_cache_path]}\\setup.xml" #
13-
# install_log_file = "#{Chef::Config[:file_cache_path]}\\DotnetAgentInstall.log" #
14-
##################################################################################################################################
157
agent_msi_path = "#{system_directory}\\Temp"
168
setup_config = "#{agent_msi_path}\\setup.xml"
179
install_log_file = "#{agent_msi_path}\\DotnetAgentInstall.log"
1810

19-
2011
# Check the bitness of the OS to determine the installer to download and run
21-
case bitness
12+
case node['kernel']['os_info']['os_architecture']
2213
when /64/
2314
agent_msi = "#{agent_msi_path}\\dotNetAgentSetup64.msi"
2415
source_path = "#{agent['source']}/dotNetAgentSetup64.msi"
2516
when /32/
2617
agent_msi = "#{agent_msi_path}\\dotNetAgentSetup.msi"
2718
source_path = "#{agent['source']}/dotNetAgentSetup.msi"
2819
else
29-
agent_msi = "Unsupported OS bitness"
20+
raise "Unsupported OS architecture"
3021
end
3122

3223
# Download the msi file from source
@@ -35,57 +26,25 @@
3526
checksum agent['checksum']
3627
end
3728

38-
#Environment Validation
39-
#####################################################################################################
40-
# Environment Validation using Powershell #
41-
#####################################################################################################
42-
# # Comment if you're installing 4.1
43-
# #Check whether the MSDTC service is up and running
44-
# #if it is not running, start the service
45-
# powershell_script 'check_MSDTC' do
46-
# code 'Start-Service MSDTC'
47-
# only_if {'(Get-Service MSDTC).status' != "Running" }
48-
# end
49-
50-
# # Comment if you're installing 4.1 -- Matt Jensen to confirm with Sanjay
51-
# #Check whether the WMI service is up and running
52-
# #if it is not running, start the service
53-
# powershell_script 'check_WMI' do
54-
# code 'Start-Service Winmgmt'
55-
# only_if {'(Get-Service Winmgmt).status' != "Running" }
56-
# end
29+
# Environment Validation
5730

58-
# # Comment if you're installing 4.1
59-
# # Check whether the COM+ service is up and running
60-
# # if it is not running, start the service
61-
# powershell_script 'check_complus' do
62-
# code 'Start-Service COMSysApp'
63-
# only_if {'(Get-Service COMSysApp).status' != "Running" }
64-
# end
65-
#####################################################################################################
66-
67-
# Comment if you're installing 4.1
68-
# Check whether the MSDTC service is up and running
69-
# if it is not running, start the service
31+
# MSDTC Service
7032
service "MSDTC" do
7133
action [ :enable, :start ]
7234
end
7335

74-
# Comment if you're installing 4.1 -- Matt Jensen to confirm with Sanjay
75-
# Check whether the WMI service is up and running
76-
# if it is not running, start the service
36+
# WMI Service
7737
service "Winmgmt" do
7838
action [ :enable, :start ]
7939
end
8040

81-
# Comment if you're installing 4.1
82-
# Check whether the COM+ service is up and running
83-
# if it is not running, start the service
84-
service "COMSysApp" do
85-
action [ :enable, :start ]
41+
if agent['version'] < '4.1'
42+
# COM+ Service is not required in 4.1+
43+
service "COMSysApp" do
44+
action [ :enable, :start ]
45+
end
8646
end
8747

88-
8948
# Check whether IIS 7.0+ is installed
9049
# Enable IIS Health Monitoring for the Machine snapshots to return IIS App Pool data
9150
# There is no equivalent available in chef to get the IIS version - so completely using powershell scripts
@@ -98,32 +57,24 @@
9857
template "#{setup_config}" do
9958
cookbook agent['template']['cookbook']
10059
source agent['template']['source']
101-
60+
10261
variables(
103-
:app_name => node['appdynamics']['app_name'],
104-
:log_file_directory => agent['logfiles_dir'],
105-
:controller_host => controller['host'],
106-
:controller_port => controller['port'],
107-
:controller_ssl => controller['ssl'],
108-
:controller_user => controller['user'],
109-
:controller_accesskey => controller['accesskey'],
110-
:proxy_host => proxy['host'],
111-
:proxy_port => proxy['port'],
62+
:app_name => node['appdynamics']['app_name'],
63+
:log_file_directory => agent['logfiles_dir'],
64+
:controller_host => controller['host'],
65+
:controller_port => controller['port'],
66+
:controller_ssl => controller['ssl'],
67+
:controller_user => controller['user'],
68+
:controller_accesskey => controller['accesskey'],
69+
:proxy_host => proxy['host'],
70+
:proxy_port => proxy['port'],
11271
)
11372
end
11473

115-
# Installing the agent
74+
# Installing the agent
11675
windows_package 'Install AppD .NET Agent' do
11776
source agent_msi
11877
options "/lv #{install_log_file} AD_SetupFile=#{setup_config} INSTALLDIR=\"#{install_directory}\""
11978
installer_type :msi
120-
only_if { File.exists?(agent_msi) }
79+
only_if { File.exists?(agent_msi) }
12180
end
122-
123-
124-
## Installing the agent -- No Dependency on windows cookbook
125-
## The below code block can also be used for installing the agent
126-
# execute "install #{agent_msi}" do
127-
# command "msiexec /i #{agent_msi} /q /norestart /lv #{install_log_file} AD_SetupFile=#{setup_config} INSTALLDIR=\"#{install_directory}\""
128-
# only_if { File.exists?(agent_msi) }
129-
# end

0 commit comments

Comments
 (0)