right_link 5.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. data/actors/agent_manager.rb +88 -0
  2. data/actors/instance_scheduler.rb +321 -0
  3. data/actors/instance_services.rb +64 -0
  4. data/actors/instance_setup.rb +567 -0
  5. data/bin/cloud +25 -0
  6. data/bin/cook_runner +44 -0
  7. data/bin/deploy +120 -0
  8. data/bin/enroll +385 -0
  9. data/bin/rad +32 -0
  10. data/bin/rchk +29 -0
  11. data/bin/rnac +39 -0
  12. data/bin/rs_connect +33 -0
  13. data/bin/rs_log_level +31 -0
  14. data/bin/rs_ohai +28 -0
  15. data/bin/rs_reenroll +31 -0
  16. data/bin/rs_run_recipe +34 -0
  17. data/bin/rs_run_right_script +34 -0
  18. data/bin/rs_shutdown +33 -0
  19. data/bin/rs_tag +33 -0
  20. data/bin/rs_thunk +33 -0
  21. data/bin/rstat +31 -0
  22. data/bin/system +16 -0
  23. data/ext/Rakefile +18 -0
  24. data/init/config.yml +5 -0
  25. data/init/init.rb +79 -0
  26. data/lib/chef/ohai_setup.rb +51 -0
  27. data/lib/chef/plugins/cloud.rb +91 -0
  28. data/lib/chef/plugins/cloudstack.rb +23 -0
  29. data/lib/chef/plugins/ec2.rb +23 -0
  30. data/lib/chef/plugins/linux/block_device2.rb +24 -0
  31. data/lib/chef/plugins/rackspace.rb +23 -0
  32. data/lib/chef/plugins/rightscale.rb +125 -0
  33. data/lib/chef/plugins/windows/network.rb +114 -0
  34. data/lib/chef/plugins.rb +74 -0
  35. data/lib/chef/providers/dns_dnsmadeeasy_provider.rb +81 -0
  36. data/lib/chef/providers/dns_resource.rb +100 -0
  37. data/lib/chef/providers/executable_schedule_provider.rb +70 -0
  38. data/lib/chef/providers/executable_schedule_resource.rb +144 -0
  39. data/lib/chef/providers/remote_recipe_provider.rb +86 -0
  40. data/lib/chef/providers/remote_recipe_resource.rb +101 -0
  41. data/lib/chef/providers/right_link_tag_provider.rb +73 -0
  42. data/lib/chef/providers/right_link_tag_resource.rb +59 -0
  43. data/lib/chef/providers/right_script_provider.rb +190 -0
  44. data/lib/chef/providers/right_script_resource.rb +113 -0
  45. data/lib/chef/providers/rs_shutdown_provider.rb +75 -0
  46. data/lib/chef/providers/rs_shutdown_resource.rb +55 -0
  47. data/lib/chef/providers/server_collection_provider.rb +66 -0
  48. data/lib/chef/providers/server_collection_resource.rb +93 -0
  49. data/lib/chef/providers/windows/powershell_provider.rb +151 -0
  50. data/lib/chef/providers/windows/powershell_resource.rb +111 -0
  51. data/lib/chef/providers/windows/unsupported_provider.rb +51 -0
  52. data/lib/chef/right_providers.rb +55 -0
  53. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ChefNodeCmdlet.csproj +104 -0
  54. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ChefNodeCmdlet.dll-Help.xml +141 -0
  55. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/Exceptions.cs +182 -0
  56. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetChefNodeCommand.cs +58 -0
  57. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetChefNodeRequest.cs +46 -0
  58. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetChefNodeResponse.cs +45 -0
  59. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetCurrentResourceCommand.cs +58 -0
  60. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetCurrentResourceRequest.cs +46 -0
  61. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetCurrentResourceResponse.cs +45 -0
  62. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNewResourceCommand.cs +58 -0
  63. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNewResourceRequest.cs +46 -0
  64. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNewResourceResponse.cs +45 -0
  65. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNextActionCommand.cs +178 -0
  66. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNextActionRequest.cs +67 -0
  67. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNextActionResponse.cs +58 -0
  68. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNodeValueCommandBase.cs +142 -0
  69. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNodeValueRequestBase.cs +64 -0
  70. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/GetNodeValueResponseBase.cs +69 -0
  71. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/JsonTransport.cs +110 -0
  72. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/PipeClient.cs +158 -0
  73. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/PipeServer.cs +142 -0
  74. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/Properties/AssemblyInfo.cs +16 -0
  75. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ProtocolConstants.cs +55 -0
  76. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ProtocolUtilities.cs +77 -0
  77. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/ReadMe.txt +53 -0
  78. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetChefNodeCommand.cs +59 -0
  79. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetChefNodeRequest.cs +46 -0
  80. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetChefNodeResponse.cs +58 -0
  81. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetCurrentResourceCommand.cs +59 -0
  82. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetCurrentResourceRequest.cs +46 -0
  83. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetCurrentResourceResponse.cs +40 -0
  84. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNewResourceCommand.cs +59 -0
  85. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNewResourceRequest.cs +46 -0
  86. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNewResourceResponse.cs +40 -0
  87. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNodeValueCommandBase.cs +293 -0
  88. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNodeValueRequestBase.cs +75 -0
  89. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/SetNodeValueResponseBase.cs +45 -0
  90. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet/Transport.cs +91 -0
  91. data/lib/chef/windows/ChefNodeCmdlet/ChefNodeCmdlet.sln +35 -0
  92. data/lib/chef/windows/ChefNodeCmdlet/TestChefNodeCmdlet/Program.cs +374 -0
  93. data/lib/chef/windows/ChefNodeCmdlet/TestChefNodeCmdlet/Properties/AssemblyInfo.cs +16 -0
  94. data/lib/chef/windows/ChefNodeCmdlet/TestChefNodeCmdlet/TestChefNodeCmdlet.csproj +65 -0
  95. data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/Program.cs +136 -0
  96. data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/Properties/AssemblyInfo.cs +36 -0
  97. data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/ReadMe.txt +46 -0
  98. data/lib/chef/windows/ChefNodeCmdlet/TestNextActionCmdlet/TestNextActionCmdlet.csproj +68 -0
  99. data/lib/chef/windows/bin/Newtonsoft.Json.dll +0 -0
  100. data/lib/chef/windows/chef_node_server.rb +463 -0
  101. data/lib/chef/windows/dynamic_powershell_provider.rb +296 -0
  102. data/lib/chef/windows/pipe_server.rb +283 -0
  103. data/lib/chef/windows/powershell_host.rb +285 -0
  104. data/lib/chef/windows/powershell_pipe_server.rb +136 -0
  105. data/lib/chef/windows/powershell_provider_base.rb +92 -0
  106. data/lib/chef/windows/scripts/run_loop.ps1 +105 -0
  107. data/lib/clouds/cloud.rb +557 -0
  108. data/lib/clouds/cloud_factory.rb +250 -0
  109. data/lib/clouds/cloud_utilities.rb +244 -0
  110. data/lib/clouds/clouds/azure.rb +106 -0
  111. data/lib/clouds/clouds/cloudstack.rb +114 -0
  112. data/lib/clouds/clouds/ec2.rb +113 -0
  113. data/lib/clouds/clouds/eucalyptus.rb +46 -0
  114. data/lib/clouds/clouds/google.rb +102 -0
  115. data/lib/clouds/clouds/none.rb +76 -0
  116. data/lib/clouds/clouds/openstack.rb +30 -0
  117. data/lib/clouds/clouds/rackspace-ng.rb +54 -0
  118. data/lib/clouds/clouds/rackspace.rb +78 -0
  119. data/lib/clouds/clouds/softlayer.rb +91 -0
  120. data/lib/clouds/metadata_formatter.rb +108 -0
  121. data/lib/clouds/metadata_provider.rb +128 -0
  122. data/lib/clouds/metadata_source.rb +87 -0
  123. data/lib/clouds/metadata_sources/certificate_metadata_source.rb +207 -0
  124. data/lib/clouds/metadata_sources/config_drive_metadata_source.rb +129 -0
  125. data/lib/clouds/metadata_sources/file_metadata_source.rb +74 -0
  126. data/lib/clouds/metadata_sources/http_metadata_source.rb +277 -0
  127. data/lib/clouds/metadata_sources/selective_metadata_source.rb +122 -0
  128. data/lib/clouds/metadata_tree_climber.rb +144 -0
  129. data/lib/clouds/metadata_writer.rb +155 -0
  130. data/lib/clouds/metadata_writers/dictionary_metadata_writer.rb +72 -0
  131. data/lib/clouds/metadata_writers/ruby_metadata_writer.rb +76 -0
  132. data/lib/clouds/metadata_writers/shell_metadata_writer.rb +121 -0
  133. data/lib/clouds/register_clouds.rb +34 -0
  134. data/lib/clouds.rb +32 -0
  135. data/lib/gem_dependencies.rb +83 -0
  136. data/lib/git_hooks/commit-msg.rb +7 -0
  137. data/lib/instance/agent_config.rb +168 -0
  138. data/lib/instance/agent_watcher.rb +233 -0
  139. data/lib/instance/audit_cook_stub.rb +104 -0
  140. data/lib/instance/audit_proxy.rb +247 -0
  141. data/lib/instance/bundle_queue.rb +104 -0
  142. data/lib/instance/cook/agent_connection.rb +109 -0
  143. data/lib/instance/cook/audit_logger.rb +165 -0
  144. data/lib/instance/cook/audit_stub.rb +142 -0
  145. data/lib/instance/cook/ca-bundle.crt +2794 -0
  146. data/lib/instance/cook/chef_state.rb +211 -0
  147. data/lib/instance/cook/cook.rb +306 -0
  148. data/lib/instance/cook/cook_state.rb +298 -0
  149. data/lib/instance/cook/cookbook_path_mapping.rb +66 -0
  150. data/lib/instance/cook/cookbook_repo_retriever.rb +190 -0
  151. data/lib/instance/cook/executable_sequence.rb +765 -0
  152. data/lib/instance/cook/external_parameter_gatherer.rb +190 -0
  153. data/lib/instance/cook/repose_downloader.rb +349 -0
  154. data/lib/instance/cook/shutdown_request_proxy.rb +121 -0
  155. data/lib/instance/cook.rb +41 -0
  156. data/lib/instance/downloader.rb +208 -0
  157. data/lib/instance/duplicable.rb +67 -0
  158. data/lib/instance/exceptions.rb +49 -0
  159. data/lib/instance/executable_sequence_proxy.rb +278 -0
  160. data/lib/instance/instance_commands.rb +577 -0
  161. data/lib/instance/instance_state.rb +633 -0
  162. data/lib/instance/json_utilities.rb +102 -0
  163. data/lib/instance/login_manager.rb +533 -0
  164. data/lib/instance/login_user_manager.rb +522 -0
  165. data/lib/instance/message_encoder.rb +118 -0
  166. data/lib/instance/multi_thread_bundle_queue.rb +232 -0
  167. data/lib/instance/operation_context.rb +60 -0
  168. data/lib/instance/options_bag.rb +65 -0
  169. data/lib/instance/payload_formatter.rb +46 -0
  170. data/lib/instance/policy.rb +53 -0
  171. data/lib/instance/policy_audit.rb +100 -0
  172. data/lib/instance/policy_manager.rb +146 -0
  173. data/lib/instance/reenroll_manager.rb +104 -0
  174. data/lib/instance/right_scripts_cookbook.rb +181 -0
  175. data/lib/instance/shutdown_request.rb +221 -0
  176. data/lib/instance/single_thread_bundle_queue.rb +189 -0
  177. data/lib/instance/volume_management.rb +450 -0
  178. data/lib/instance.rb +50 -0
  179. data/lib/repo_conf_generators/apt_conf_generators.rb +106 -0
  180. data/lib/repo_conf_generators/gem_conf_generators.rb +80 -0
  181. data/lib/repo_conf_generators/rightscale_conf_generators.rb +254 -0
  182. data/lib/repo_conf_generators/rightscale_key.pub +17 -0
  183. data/lib/repo_conf_generators/yum_conf_generators.rb +225 -0
  184. data/lib/repo_conf_generators.rb +30 -0
  185. data/lib/run_shell.rb +28 -0
  186. data/scripts/agent_checker.rb +571 -0
  187. data/scripts/agent_controller.rb +247 -0
  188. data/scripts/agent_deployer.rb +148 -0
  189. data/scripts/bundle_runner.rb +336 -0
  190. data/scripts/cloud_controller.rb +176 -0
  191. data/scripts/log_level_manager.rb +142 -0
  192. data/scripts/ohai_runner.rb +33 -0
  193. data/scripts/reenroller.rb +193 -0
  194. data/scripts/server_importer.rb +293 -0
  195. data/scripts/shutdown_client.rb +183 -0
  196. data/scripts/system_configurator.rb +367 -0
  197. data/scripts/tagger.rb +381 -0
  198. data/scripts/thunker.rb +356 -0
  199. metadata +418 -0
@@ -0,0 +1,51 @@
1
+ #
2
+ # Copyright (c) 2010-2011 RightScale Inc
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ class Chef
24
+ class Provider
25
+ class WindowsUnsupported < Chef::Provider::Execute
26
+
27
+ class UnsupportedException < StandardError
28
+ def initialize(resource)
29
+ message = "The \"#{resource.resource_name}\" resource referenced in recipe \"#{resource.cookbook_name}::#{resource.recipe_name}\" is not supported on Windows."
30
+ super(message)
31
+ end
32
+ end
33
+
34
+ def action_run
35
+ raise(UnsupportedException, @new_resource)
36
+ end
37
+
38
+ end
39
+ end
40
+ end
41
+
42
+ # self-register
43
+ Chef::Platform.platforms[:windows][:default].merge!(:link => Chef::Provider::WindowsUnsupported, # not yet implemented. NTFS supports hard & symbolic links.
44
+ :mount => Chef::Provider::WindowsUnsupported, # not yet implemented. NTFS supports mount points.
45
+ :service => Chef::Provider::WindowsUnsupported, # not yet implemented. 'net' commands are used to start/stop services.
46
+ :bash => Chef::Provider::WindowsUnsupported, # we don't intend to support Linux
47
+ :csh => Chef::Provider::WindowsUnsupported, # shells under Windows.
48
+ :user => Chef::Provider::WindowsUnsupported, # not yet implemented. need a custom provider.
49
+ :group => Chef::Provider::WindowsUnsupported, # not yet implemented. need a custom provider.
50
+ :route => Chef::Provider::WindowsUnsupported, # not yet implemented. WMI supports DNS configuration.
51
+ :ifconfig => Chef::Provider::WindowsUnsupported) # not yet implemented. WMI supports DNS configuration.
@@ -0,0 +1,55 @@
1
+ #
2
+ # Copyright (c) 2009-2011 RightScale Inc
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+
23
+ # The daemonize method of AR clashes with the daemonize Chef attribute, we don't need that method so undef it
24
+ undef :daemonize if methods.include?('daemonize')
25
+
26
+ require 'chef'
27
+ require 'chef/client'
28
+
29
+ BASE_RIGHT_CHEF_LIB_DIR_PATH = File.normalize_path(File.dirname(__FILE__))
30
+ BASE_RIGHT_CHEF_PROVIDER_DIR_PATH = File.join(BASE_RIGHT_CHEF_LIB_DIR_PATH, 'providers')
31
+
32
+ # load (and self-register) all common providers
33
+ pattern = File.join(BASE_RIGHT_CHEF_PROVIDER_DIR_PATH, '*.rb')
34
+ Dir[pattern].each do |rb_file|
35
+ require File.normalize_path(rb_file)
36
+ end
37
+
38
+ if RightScale::Platform.windows?
39
+
40
+ DYNAMIC_WINDOWS_CHEF_PROVIDERS_PATH = File.join(BASE_RIGHT_CHEF_LIB_DIR_PATH, 'windows')
41
+ STATIC_WINDOWS_CHEF_PROVIDERS_PATH = File.join(BASE_RIGHT_CHEF_PROVIDER_DIR_PATH, 'windows')
42
+ WINDOWS_CHEF_PROVIDERS_PATHS = [STATIC_WINDOWS_CHEF_PROVIDERS_PATH, DYNAMIC_WINDOWS_CHEF_PROVIDERS_PATH]
43
+
44
+ # create the Windows default platform hash before loading windows providers.
45
+ Chef::Platform.platforms[:windows] = { :default => { } } unless Chef::Platform.platforms[:windows]
46
+
47
+ # load (and self-register) all static/dynamic Windows providers.
48
+ WINDOWS_CHEF_PROVIDERS_PATHS.each do |base_path|
49
+ pattern = File.join(base_path, '*.rb')
50
+ Dir[pattern].each do |rb_file|
51
+ require File.normalize_path(rb_file)
52
+ end
53
+ end
54
+
55
+ end
@@ -0,0 +1,104 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <PropertyGroup>
4
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6
+ <ProductVersion>9.0.30729</ProductVersion>
7
+ <SchemaVersion>2.0</SchemaVersion>
8
+ <ProjectGuid>{F421745A-3ADE-473A-83DE-C7A3DF1B9557}</ProjectGuid>
9
+ <OutputType>Library</OutputType>
10
+ <AppDesignerFolder>Properties</AppDesignerFolder>
11
+ <RootNamespace>ChefNodeCmdlet</RootNamespace>
12
+ <AssemblyName>ChefNodeCmdlet</AssemblyName>
13
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
14
+ <FileAlignment>512</FileAlignment>
15
+ </PropertyGroup>
16
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+ <DebugSymbols>true</DebugSymbols>
18
+ <DebugType>full</DebugType>
19
+ <Optimize>false</Optimize>
20
+ <OutputPath>$(SolutionDir)\$(Configuration)</OutputPath>
21
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
22
+ <ErrorReport>prompt</ErrorReport>
23
+ <WarningLevel>4</WarningLevel>
24
+ </PropertyGroup>
25
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26
+ <DebugType>pdbonly</DebugType>
27
+ <Optimize>true</Optimize>
28
+ <OutputPath>$(SolutionDir)\$(Configuration)</OutputPath>
29
+ <DefineConstants>TRACE</DefineConstants>
30
+ <ErrorReport>prompt</ErrorReport>
31
+ <WarningLevel>4</WarningLevel>
32
+ </PropertyGroup>
33
+ <ItemGroup>
34
+ <Reference Include="Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, processorArchitecture=MSIL">
35
+ <SpecificVersion>False</SpecificVersion>
36
+ <HintPath>..\..\bin\Newtonsoft.Json.dll</HintPath>
37
+ </Reference>
38
+ <Reference Include="System" />
39
+ <Reference Include="System.Core">
40
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
41
+ </Reference>
42
+ <Reference Include="System.Management.Automation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
43
+ <SpecificVersion>False</SpecificVersion>
44
+ <HintPath>..\..\..\..\..\..\..\..\..\Windows\winsxs\msil_system.management.automation_31bf3856ad364e35_7.0.6002.18111_none_14b22ca46865e010\System.Management.Automation.dll</HintPath>
45
+ </Reference>
46
+ </ItemGroup>
47
+ <ItemGroup>
48
+ <Compile Include="Exceptions.cs" />
49
+ <Compile Include="GetChefNodeCommand.cs" />
50
+ <Compile Include="GetChefNodeRequest.cs" />
51
+ <Compile Include="GetChefNodeResponse.cs" />
52
+ <Compile Include="GetCurrentResourceCommand.cs" />
53
+ <Compile Include="GetCurrentResourceRequest.cs" />
54
+ <Compile Include="GetCurrentResourceResponse.cs" />
55
+ <Compile Include="GetNewResourceCommand.cs" />
56
+ <Compile Include="GetNewResourceRequest.cs" />
57
+ <Compile Include="GetNewResourceResponse.cs" />
58
+ <Compile Include="GetNextActionCommand.cs" />
59
+ <Compile Include="GetNextActionRequest.cs" />
60
+ <Compile Include="GetNextActionResponse.cs" />
61
+ <Compile Include="GetNodeValueCommandBase.cs" />
62
+ <Compile Include="GetNodeValueRequestBase.cs" />
63
+ <Compile Include="GetNodeValueResponseBase.cs" />
64
+ <Compile Include="JsonTransport.cs" />
65
+ <Compile Include="PipeClient.cs" />
66
+ <Compile Include="PipeServer.cs" />
67
+ <Compile Include="ProtocolConstants.cs" />
68
+ <Compile Include="ProtocolUtilities.cs" />
69
+ <Compile Include="SetChefNodeCommand.cs" />
70
+ <Compile Include="Properties\AssemblyInfo.cs" />
71
+ <Compile Include="SetChefNodeRequest.cs" />
72
+ <Compile Include="SetChefNodeResponse.cs" />
73
+ <Compile Include="SetCurrentResourceCommand.cs" />
74
+ <Compile Include="SetCurrentResourceRequest.cs" />
75
+ <Compile Include="SetCurrentResourceResponse.cs" />
76
+ <Compile Include="SetNewResourceCommand.cs" />
77
+ <Compile Include="SetNewResourceRequest.cs" />
78
+ <Compile Include="SetNewResourceResponse.cs" />
79
+ <Compile Include="SetNodeValueCommandBase.cs" />
80
+ <Compile Include="SetNodeValueRequestBase.cs" />
81
+ <Compile Include="SetNodeValueResponseBase.cs" />
82
+ <Compile Include="Transport.cs" />
83
+ </ItemGroup>
84
+ <ItemGroup>
85
+ <Content Include="ReadMe.txt" />
86
+ </ItemGroup>
87
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
88
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
89
+ Other similar extension points exist, see Microsoft.Common.targets.
90
+ <Target Name="BeforeBuild">
91
+ </Target>
92
+ <Target Name="AfterBuild">
93
+ </Target>
94
+ -->
95
+ <PropertyGroup>
96
+ <PostBuildEvent>if "$(ConfigurationName)" equ "Release" (
97
+ if not exist "$(ProjectDir)..\..\bin" md "$(ProjectDir)..\..\bin"
98
+ xcopy /F /R /Y "$(TargetPath)" "$(ProjectDir)..\..\bin\*"
99
+ xcopy /F /R /Y "$(ProjectDir)ChefNodeCmdlet.dll-Help.xml" "$(ProjectDir)..\..\bin\*"
100
+ )
101
+
102
+ </PostBuildEvent>
103
+ </PropertyGroup>
104
+ </Project>
@@ -0,0 +1,141 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+
3
+ <helpItems xmlns="http://msh" schema="maml">
4
+
5
+ <command:command xmlns:maml="http://schemas.microsoft.com/maml/2004/10" xmlns:command="http://schemas.microsoft.com/maml/dev/command/2004/10" xmlns:dev="http://schemas.microsoft.com/maml/dev/2004/10">
6
+ <command:details>
7
+ <command:name>
8
+ Get-ChefNode
9
+ </command:name>
10
+ <maml:description>
11
+ <maml:para>Queries the value of the Chef node at a given depth.</maml:para>
12
+ </maml:description>
13
+ <maml:copyright>
14
+ <maml:para></maml:para>
15
+ </maml:copyright>
16
+ <command:verb>Get</command:verb>
17
+ <command:noun>ChefNode</command:noun>
18
+ <dev:version></dev:version>
19
+ </command:details>
20
+ <maml:description>
21
+ <maml:para>verbose description...</maml:para>
22
+ </maml:description>
23
+
24
+ <!-- Cmdlet syntax section-->
25
+ <command:syntax>
26
+ <command:syntaxItem>
27
+ <maml:name>Get-ChefNode</maml:name>
28
+ <command:parameter required="true" pipelineInput="true (ByPosition)" position="1">
29
+ <maml:name>Path</maml:name>
30
+ <maml:description>
31
+ <maml:para>Specifies the path to the Chef node to query, given as an array of string elements corresponding to the hash indexes on the Chef node object.</maml:para>
32
+ </maml:description>
33
+ <command:parameterValue required="true">string[]</command:parameterValue>
34
+ </command:parameter>
35
+ </command:syntaxItem>
36
+ </command:syntax>
37
+
38
+ <!-- Cmdlet parameter section -->
39
+ <command:parameters>
40
+ <command:parameter required="true" pipelineInput="true (ByPosition)" position="1">
41
+ <maml:name>Path</maml:name>
42
+ <maml:description>
43
+ <maml:para>.</maml:para>
44
+ </maml:description>
45
+ <command:parameterValue required="true">string[]</command:parameterValue>
46
+ <dev:type>
47
+ <maml:name>string[]</maml:name>
48
+ <maml:uri/>
49
+ </dev:type>
50
+ <dev:defaultValue>N/A - The path must be specified</dev:defaultValue>
51
+ </command:parameter>
52
+ </command:parameters>
53
+
54
+ <!-- Input - Output section-->
55
+ <command:inputTypes>
56
+ <command:inputType>
57
+ <dev:type>
58
+ <maml:name>String</maml:name>
59
+ <maml:uri/>
60
+ <maml:description>
61
+ <maml:para>
62
+ <!-- description -->
63
+ You can enter parameters as strings at the command line or pipe objects to the cmdlet.
64
+ </maml:para>
65
+ </maml:description>
66
+ </dev:type>
67
+ <maml:description></maml:description>
68
+ </command:inputType>
69
+ </command:inputTypes>
70
+
71
+ <!-- Return Values section -->
72
+ <command:returnValues>
73
+ <command:returnValue>
74
+ <dev:type>
75
+ <maml:name>Objects of any primitive type, array or hash.</maml:name>
76
+ <maml:uri />
77
+ <maml:description>
78
+ <maml:para>
79
+ <!-- description -->
80
+
81
+ </maml:para>
82
+ </maml:description>
83
+ </dev:type>
84
+ <maml:description></maml:description>
85
+ </command:returnValue>
86
+ </command:returnValues>
87
+ <command:terminatingErrors />
88
+ <command:nonTerminatingErrors />
89
+
90
+ <!-- Notes section -->
91
+ <maml:alertSet>
92
+ <maml:title></maml:title>
93
+ <maml:alert>
94
+ <maml:para>
95
+ Notes.
96
+ </maml:para>
97
+ </maml:alert>
98
+ <maml:alert>
99
+ <maml:para></maml:para>
100
+ </maml:alert>
101
+ </maml:alertSet>
102
+
103
+ <!-- Example section -->
104
+ <command:examples>
105
+ <command:example>
106
+ <maml:title>
107
+ -------------------------- EXAMPLE 1 --------------------------
108
+ </maml:title>
109
+ <maml:introduction>
110
+ <maml:para>C:\PS&gt;</maml:para>
111
+ </maml:introduction>
112
+ <dev:code>get-chefnode &quot;&quot;</dev:code>
113
+ <dev:remarks>
114
+ <maml:para>This command queries the names of the keys at the root of the Chef node and returns them as an array.</maml:para>
115
+ </dev:remarks>
116
+ <command:commandLines>
117
+ <command:commandLine>
118
+ <command:commandText></command:commandText>
119
+ </command:commandLine>
120
+ </command:commandLines>
121
+ </command:example>
122
+ </command:examples>
123
+
124
+ <!-- Link section -->
125
+ <maml:relatedLinks>
126
+ <maml:navigationLink>
127
+ <maml:linkText>Get-ChefNode</maml:linkText>
128
+ <maml:uri/>
129
+ </maml:navigationLink>
130
+ <maml:navigationLink>
131
+ <maml:linkText>Set-ChefNode</maml:linkText>
132
+ <maml:uri/>
133
+ </maml:navigationLink>
134
+ <maml:navigationLink>
135
+ <maml:linkText>Get-NextAction</maml:linkText>
136
+ <maml:uri/>
137
+ </maml:navigationLink>
138
+ </maml:relatedLinks>
139
+ </command:command>
140
+
141
+ </helpItems>
@@ -0,0 +1,182 @@
1
+ /////////////////////////////////////////////////////////////////////////
2
+ // Copyright (c) 2010-2011 RightScale Inc
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining
5
+ // a copy of this software and associated documentation files (the
6
+ // "Software"), to deal in the Software without restriction, including
7
+ // without limitation the rights to use, copy, modify, merge, publish,
8
+ // distribute, sublicense, and/or sell copies of the Software, and to
9
+ // permit persons to whom the Software is furnished to do so, subject to
10
+ // the following conditions:
11
+ //
12
+ // The above copyright notice and this permission notice shall be
13
+ // included in all copies or substantial portions of the Software.
14
+ //
15
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ /////////////////////////////////////////////////////////////////////////
23
+ using System;
24
+ using System.Collections;
25
+
26
+ namespace RightScale
27
+ {
28
+ namespace Powershell
29
+ {
30
+ namespace Exceptions
31
+ {
32
+ // Summary:
33
+ // base exception class for exceptions thrown by common code.
34
+ public class ChefNodeCmdletExceptionBase : Exception
35
+ {
36
+ public static string ERROR_KEY = "Error";
37
+ public static string DETAIL_KEY = "Detail";
38
+
39
+ public ChefNodeCmdletExceptionBase()
40
+ : base()
41
+ {
42
+ }
43
+
44
+ public ChefNodeCmdletExceptionBase(Exception e)
45
+ : base(e.Message, e)
46
+ {
47
+ }
48
+
49
+ public ChefNodeCmdletExceptionBase(string message)
50
+ : base(message)
51
+ {
52
+ }
53
+
54
+ public ChefNodeCmdletExceptionBase(string message, Exception innerException)
55
+ : base(message, innerException)
56
+ {
57
+ }
58
+
59
+ public ChefNodeCmdletExceptionBase(IDictionary response)
60
+ : base(CreateMessage(response))
61
+ {
62
+ }
63
+
64
+ public static bool HasError(IDictionary response)
65
+ {
66
+ return response.Contains(ERROR_KEY);
67
+ }
68
+
69
+ private static string CreateMessage(IDictionary response)
70
+ {
71
+ string message = response[ERROR_KEY].ToString();
72
+
73
+ if (response.Contains(DETAIL_KEY))
74
+ {
75
+ message = String.Format("{0}\n{1}", message, response[DETAIL_KEY]);
76
+ }
77
+
78
+ return message;
79
+ }
80
+ }
81
+
82
+ // exceptions for get-ChefNode cmdlet
83
+ class GetChefNodeException : ChefNodeCmdletExceptionBase
84
+ {
85
+ public GetChefNodeException(string message)
86
+ : base(message)
87
+ {
88
+ }
89
+
90
+ public GetChefNodeException(IDictionary response)
91
+ : base(response)
92
+ {
93
+ }
94
+
95
+ }
96
+
97
+ // exceptions for set-ChefNode cmdlet
98
+ class SetChefNodeException : ChefNodeCmdletExceptionBase
99
+ {
100
+ public SetChefNodeException(string message)
101
+ : base(message)
102
+ {
103
+ }
104
+
105
+ public SetChefNodeException(IDictionary response)
106
+ : base(response)
107
+ {
108
+ }
109
+ }
110
+
111
+ // exceptions for set-ChefNode cmdlet
112
+ class GetNextActionException : ChefNodeCmdletExceptionBase
113
+ {
114
+ public GetNextActionException(string message)
115
+ : base(message)
116
+ {
117
+ }
118
+
119
+ public GetNextActionException(IDictionary response)
120
+ : base(response)
121
+ {
122
+ }
123
+ }
124
+
125
+ // exceptions for Get-CurrentResource cmdlet
126
+ class GetCurrentResourceException : ChefNodeCmdletExceptionBase
127
+ {
128
+ public GetCurrentResourceException(string message)
129
+ : base(message)
130
+ {
131
+ }
132
+
133
+ public GetCurrentResourceException(IDictionary response)
134
+ : base(response)
135
+ {
136
+ }
137
+ }
138
+
139
+ // exceptions for Set-CurrentResource cmdlet
140
+ class SetCurrentResourceException : ChefNodeCmdletExceptionBase
141
+ {
142
+ public SetCurrentResourceException(string message)
143
+ : base(message)
144
+ {
145
+ }
146
+
147
+ public SetCurrentResourceException(IDictionary response)
148
+ : base(response)
149
+ {
150
+ }
151
+ }
152
+
153
+ // exceptions for Get-NewResource cmdlet
154
+ class GetNewResourceException : ChefNodeCmdletExceptionBase
155
+ {
156
+ public GetNewResourceException(string message)
157
+ : base(message)
158
+ {
159
+ }
160
+
161
+ public GetNewResourceException(IDictionary response)
162
+ : base(response)
163
+ {
164
+ }
165
+ }
166
+
167
+ // exceptions for Get-NewResource cmdlet
168
+ class SetNewResourceException : ChefNodeCmdletExceptionBase
169
+ {
170
+ public SetNewResourceException(string message)
171
+ : base(message)
172
+ {
173
+ }
174
+
175
+ public SetNewResourceException(IDictionary response)
176
+ : base(response)
177
+ {
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
@@ -0,0 +1,58 @@
1
+ /////////////////////////////////////////////////////////////////////////
2
+ // Copyright (c) 2010-2011 RightScale Inc
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining
5
+ // a copy of this software and associated documentation files (the
6
+ // "Software"), to deal in the Software without restriction, including
7
+ // without limitation the rights to use, copy, modify, merge, publish,
8
+ // distribute, sublicense, and/or sell copies of the Software, and to
9
+ // permit persons to whom the Software is furnished to do so, subject to
10
+ // the following conditions:
11
+ //
12
+ // The above copyright notice and this permission notice shall be
13
+ // included in all copies or substantial portions of the Software.
14
+ //
15
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ /////////////////////////////////////////////////////////////////////////
23
+ using System;
24
+ using System.Collections;
25
+ using System.Management.Automation;
26
+ using System.Threading;
27
+ using RightScale.Common.Protocol;
28
+ using RightScale.Chef.Protocol;
29
+ using RightScale.Powershell.Exceptions;
30
+
31
+ namespace RightScale
32
+ {
33
+ namespace Powershell
34
+ {
35
+ namespace Commands
36
+ {
37
+ // Provides the Set-ChefNode cmdlet.
38
+ [Cmdlet(VerbsCommon.Get, "ChefNode")]
39
+ public class GetChefNodeCommand : GetNodeValueCommandBase
40
+ {
41
+ protected override GetNodeValueRequestBase CreateRequest()
42
+ {
43
+ return new GetChefNodeRequest(Path);
44
+ }
45
+
46
+ protected override ChefNodeCmdletExceptionBase CreateException(string message)
47
+ {
48
+ return new GetChefNodeException(message);
49
+ }
50
+
51
+ protected override ChefNodeCmdletExceptionBase CreateException(IDictionary responseHash)
52
+ {
53
+ return new GetChefNodeException(responseHash);
54
+ }
55
+ }
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,46 @@
1
+ /////////////////////////////////////////////////////////////////////////
2
+ // Copyright (c) 2010-2011 RightScale Inc
3
+ //
4
+ // Permission is hereby granted, free of charge, to any person obtaining
5
+ // a copy of this software and associated documentation files (the
6
+ // "Software"), to deal in the Software without restriction, including
7
+ // without limitation the rights to use, copy, modify, merge, publish,
8
+ // distribute, sublicense, and/or sell copies of the Software, and to
9
+ // permit persons to whom the Software is furnished to do so, subject to
10
+ // the following conditions:
11
+ //
12
+ // The above copyright notice and this permission notice shall be
13
+ // included in all copies or substantial portions of the Software.
14
+ //
15
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ /////////////////////////////////////////////////////////////////////////
23
+ using System;
24
+ using System.Collections;
25
+
26
+ namespace RightScale
27
+ {
28
+ namespace Chef
29
+ {
30
+ namespace Protocol
31
+ {
32
+ // data for a get-ChefNode request
33
+ public class GetChefNodeRequest : GetNodeValueRequestBase
34
+ {
35
+ public GetChefNodeRequest()
36
+ {
37
+ }
38
+
39
+ public GetChefNodeRequest(ICollection path)
40
+ : base(path)
41
+ {
42
+ }
43
+ }
44
+ }
45
+ }
46
+ }