right_agent 2.0.7-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.rdoc +82 -0
- data/Rakefile +113 -0
- data/lib/right_agent.rb +59 -0
- data/lib/right_agent/actor.rb +182 -0
- data/lib/right_agent/actor_registry.rb +76 -0
- data/lib/right_agent/actors/agent_manager.rb +232 -0
- data/lib/right_agent/agent.rb +1149 -0
- data/lib/right_agent/agent_config.rb +480 -0
- data/lib/right_agent/agent_identity.rb +210 -0
- data/lib/right_agent/agent_tag_manager.rb +237 -0
- data/lib/right_agent/audit_formatter.rb +107 -0
- data/lib/right_agent/clients.rb +31 -0
- data/lib/right_agent/clients/api_client.rb +383 -0
- data/lib/right_agent/clients/auth_client.rb +247 -0
- data/lib/right_agent/clients/balanced_http_client.rb +369 -0
- data/lib/right_agent/clients/base_retry_client.rb +495 -0
- data/lib/right_agent/clients/right_http_client.rb +279 -0
- data/lib/right_agent/clients/router_client.rb +493 -0
- data/lib/right_agent/command.rb +30 -0
- data/lib/right_agent/command/agent_manager_commands.rb +150 -0
- data/lib/right_agent/command/command_client.rb +136 -0
- data/lib/right_agent/command/command_constants.rb +33 -0
- data/lib/right_agent/command/command_io.rb +126 -0
- data/lib/right_agent/command/command_parser.rb +87 -0
- data/lib/right_agent/command/command_runner.rb +118 -0
- data/lib/right_agent/command/command_serializer.rb +63 -0
- data/lib/right_agent/connectivity_checker.rb +179 -0
- data/lib/right_agent/console.rb +65 -0
- data/lib/right_agent/core_payload_types.rb +44 -0
- data/lib/right_agent/core_payload_types/cookbook.rb +61 -0
- data/lib/right_agent/core_payload_types/cookbook_position.rb +46 -0
- data/lib/right_agent/core_payload_types/cookbook_repository.rb +116 -0
- data/lib/right_agent/core_payload_types/cookbook_sequence.rb +70 -0
- data/lib/right_agent/core_payload_types/dev_repositories.rb +100 -0
- data/lib/right_agent/core_payload_types/dev_repository.rb +76 -0
- data/lib/right_agent/core_payload_types/event_categories.rb +38 -0
- data/lib/right_agent/core_payload_types/executable_bundle.rb +130 -0
- data/lib/right_agent/core_payload_types/login_policy.rb +72 -0
- data/lib/right_agent/core_payload_types/login_user.rb +79 -0
- data/lib/right_agent/core_payload_types/planned_volume.rb +94 -0
- data/lib/right_agent/core_payload_types/recipe_instantiation.rb +73 -0
- data/lib/right_agent/core_payload_types/repositories_bundle.rb +50 -0
- data/lib/right_agent/core_payload_types/right_script_attachment.rb +95 -0
- data/lib/right_agent/core_payload_types/right_script_instantiation.rb +94 -0
- data/lib/right_agent/core_payload_types/runlist_policy.rb +44 -0
- data/lib/right_agent/core_payload_types/secure_document.rb +66 -0
- data/lib/right_agent/core_payload_types/secure_document_location.rb +63 -0
- data/lib/right_agent/core_payload_types/software_repository_instantiation.rb +61 -0
- data/lib/right_agent/daemonize.rb +35 -0
- data/lib/right_agent/dispatched_cache.rb +109 -0
- data/lib/right_agent/dispatcher.rb +272 -0
- data/lib/right_agent/enrollment_result.rb +221 -0
- data/lib/right_agent/exceptions.rb +87 -0
- data/lib/right_agent/history.rb +145 -0
- data/lib/right_agent/log.rb +460 -0
- data/lib/right_agent/minimal.rb +46 -0
- data/lib/right_agent/monkey_patches.rb +30 -0
- data/lib/right_agent/monkey_patches/ruby_patch.rb +55 -0
- data/lib/right_agent/monkey_patches/ruby_patch/array_patch.rb +29 -0
- data/lib/right_agent/monkey_patches/ruby_patch/darwin_patch.rb +24 -0
- data/lib/right_agent/monkey_patches/ruby_patch/linux_patch.rb +24 -0
- data/lib/right_agent/monkey_patches/ruby_patch/linux_patch/file_patch.rb +30 -0
- data/lib/right_agent/monkey_patches/ruby_patch/object_patch.rb +49 -0
- data/lib/right_agent/monkey_patches/ruby_patch/windows_patch.rb +32 -0
- data/lib/right_agent/monkey_patches/ruby_patch/windows_patch/file_patch.rb +60 -0
- data/lib/right_agent/monkey_patches/ruby_patch/windows_patch/process_patch.rb +63 -0
- data/lib/right_agent/monkey_patches/ruby_patch/windows_patch/stdio_patch.rb +27 -0
- data/lib/right_agent/monkey_patches/ruby_patch/windows_patch/time_patch.rb +55 -0
- data/lib/right_agent/monkey_patches/ruby_patch/windows_patch/win32ole_patch.rb +34 -0
- data/lib/right_agent/multiplexer.rb +102 -0
- data/lib/right_agent/offline_handler.rb +270 -0
- data/lib/right_agent/operation_result.rb +300 -0
- data/lib/right_agent/packets.rb +673 -0
- data/lib/right_agent/payload_formatter.rb +104 -0
- data/lib/right_agent/pending_requests.rb +128 -0
- data/lib/right_agent/pid_file.rb +159 -0
- data/lib/right_agent/platform.rb +770 -0
- data/lib/right_agent/platform/unix/darwin/platform.rb +102 -0
- data/lib/right_agent/platform/unix/linux/platform.rb +305 -0
- data/lib/right_agent/platform/unix/platform.rb +226 -0
- data/lib/right_agent/platform/windows/mingw/platform.rb +447 -0
- data/lib/right_agent/platform/windows/mswin/platform.rb +236 -0
- data/lib/right_agent/platform/windows/platform.rb +1808 -0
- data/lib/right_agent/protocol_version_mixin.rb +69 -0
- data/lib/right_agent/retryable_request.rb +195 -0
- data/lib/right_agent/scripts/agent_controller.rb +543 -0
- data/lib/right_agent/scripts/agent_deployer.rb +400 -0
- data/lib/right_agent/scripts/common_parser.rb +160 -0
- data/lib/right_agent/scripts/log_level_manager.rb +192 -0
- data/lib/right_agent/scripts/stats_manager.rb +268 -0
- data/lib/right_agent/scripts/usage.rb +58 -0
- data/lib/right_agent/secure_identity.rb +92 -0
- data/lib/right_agent/security.rb +32 -0
- data/lib/right_agent/security/cached_certificate_store_proxy.rb +77 -0
- data/lib/right_agent/security/certificate.rb +102 -0
- data/lib/right_agent/security/certificate_cache.rb +89 -0
- data/lib/right_agent/security/distinguished_name.rb +56 -0
- data/lib/right_agent/security/encrypted_document.rb +83 -0
- data/lib/right_agent/security/rsa_key_pair.rb +76 -0
- data/lib/right_agent/security/signature.rb +86 -0
- data/lib/right_agent/security/static_certificate_store.rb +85 -0
- data/lib/right_agent/sender.rb +792 -0
- data/lib/right_agent/serialize.rb +29 -0
- data/lib/right_agent/serialize/message_pack.rb +107 -0
- data/lib/right_agent/serialize/secure_serializer.rb +151 -0
- data/lib/right_agent/serialize/secure_serializer_initializer.rb +47 -0
- data/lib/right_agent/serialize/serializable.rb +151 -0
- data/lib/right_agent/serialize/serializer.rb +159 -0
- data/lib/right_agent/subprocess.rb +38 -0
- data/lib/right_agent/tracer.rb +124 -0
- data/right_agent.gemspec +101 -0
- data/spec/actor_registry_spec.rb +80 -0
- data/spec/actor_spec.rb +162 -0
- data/spec/agent_config_spec.rb +235 -0
- data/spec/agent_identity_spec.rb +78 -0
- data/spec/agent_spec.rb +734 -0
- data/spec/agent_tag_manager_spec.rb +319 -0
- data/spec/clients/api_client_spec.rb +423 -0
- data/spec/clients/auth_client_spec.rb +272 -0
- data/spec/clients/balanced_http_client_spec.rb +576 -0
- data/spec/clients/base_retry_client_spec.rb +635 -0
- data/spec/clients/router_client_spec.rb +594 -0
- data/spec/clients/spec_helper.rb +111 -0
- data/spec/command/agent_manager_commands_spec.rb +51 -0
- data/spec/command/command_io_spec.rb +93 -0
- data/spec/command/command_parser_spec.rb +79 -0
- data/spec/command/command_runner_spec.rb +107 -0
- data/spec/command/command_serializer_spec.rb +51 -0
- data/spec/connectivity_checker_spec.rb +83 -0
- data/spec/core_payload_types/dev_repositories_spec.rb +64 -0
- data/spec/core_payload_types/dev_repository_spec.rb +33 -0
- data/spec/core_payload_types/executable_bundle_spec.rb +67 -0
- data/spec/core_payload_types/login_user_spec.rb +102 -0
- data/spec/core_payload_types/recipe_instantiation_spec.rb +81 -0
- data/spec/core_payload_types/right_script_attachment_spec.rb +65 -0
- data/spec/core_payload_types/right_script_instantiation_spec.rb +79 -0
- data/spec/core_payload_types/spec_helper.rb +23 -0
- data/spec/dispatched_cache_spec.rb +136 -0
- data/spec/dispatcher_spec.rb +324 -0
- data/spec/enrollment_result_spec.rb +53 -0
- data/spec/history_spec.rb +246 -0
- data/spec/log_spec.rb +192 -0
- data/spec/monkey_patches/eventmachine_spec.rb +62 -0
- data/spec/multiplexer_spec.rb +48 -0
- data/spec/offline_handler_spec.rb +340 -0
- data/spec/operation_result_spec.rb +208 -0
- data/spec/packets_spec.rb +461 -0
- data/spec/pending_requests_spec.rb +136 -0
- data/spec/platform/spec_helper.rb +216 -0
- data/spec/platform/unix/darwin/platform_spec.rb +181 -0
- data/spec/platform/unix/linux/platform_spec.rb +540 -0
- data/spec/platform/unix/spec_helper.rb +149 -0
- data/spec/platform/windows/mingw/platform_spec.rb +222 -0
- data/spec/platform/windows/mswin/platform_spec.rb +259 -0
- data/spec/platform/windows/spec_helper.rb +720 -0
- data/spec/retryable_request_spec.rb +306 -0
- data/spec/secure_identity_spec.rb +50 -0
- data/spec/security/cached_certificate_store_proxy_spec.rb +62 -0
- data/spec/security/certificate_cache_spec.rb +71 -0
- data/spec/security/certificate_spec.rb +49 -0
- data/spec/security/distinguished_name_spec.rb +46 -0
- data/spec/security/encrypted_document_spec.rb +55 -0
- data/spec/security/rsa_key_pair_spec.rb +55 -0
- data/spec/security/signature_spec.rb +66 -0
- data/spec/security/static_certificate_store_spec.rb +58 -0
- data/spec/sender_spec.rb +1045 -0
- data/spec/serialize/message_pack_spec.rb +131 -0
- data/spec/serialize/secure_serializer_spec.rb +132 -0
- data/spec/serialize/serializable_spec.rb +90 -0
- data/spec/serialize/serializer_spec.rb +197 -0
- data/spec/spec.opts +2 -0
- data/spec/spec.win32.opts +1 -0
- data/spec/spec_helper.rb +130 -0
- data/spec/tracer_spec.rb +114 -0
- metadata +447 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright: 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 NONINFRINGEMENT.
|
18
|
+
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
19
|
+
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
20
|
+
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
21
|
+
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
24
|
+
module RightScale
|
25
|
+
# Sequence of cookbooks to be checked out on the instance.
|
26
|
+
class DevRepository
|
27
|
+
include Serializable
|
28
|
+
|
29
|
+
# (Symbol) Type of repository: one of :git, :svn, :download or :local
|
30
|
+
# * :git denotes a 'git' repository that should be retrieved via 'git clone'
|
31
|
+
# * :svn denotes a 'svn' repository that should be retrieved via 'svn checkout'
|
32
|
+
# * :download denotes a tar ball that should be retrieved via HTTP GET (HTTPS if uri starts with https://)
|
33
|
+
# * :local denotes cookbook that is already local and doesn't need to be retrieved
|
34
|
+
attr_accessor :repo_type
|
35
|
+
# (String) URL to repository (e.g. git://github.com/opscode/chef-repo.git)
|
36
|
+
attr_accessor :url
|
37
|
+
# (String) git commit or svn branch that should be used to retrieve repository
|
38
|
+
# Optional, use 'master' for git and 'trunk' for svn if tag is nil.
|
39
|
+
# Not used for raw repositories.
|
40
|
+
attr_accessor :tag
|
41
|
+
# (Array) Path to cookbooks inside repostory
|
42
|
+
# Optional (use location of repository as cookbook path if nil)
|
43
|
+
attr_accessor :cookbooks_path
|
44
|
+
# (String) Private SSH key used to retrieve git repositories
|
45
|
+
# Optional, not used for svn and raw repositories.
|
46
|
+
attr_accessor :ssh_key
|
47
|
+
# (String) Username used to retrieve svn and raw repositories
|
48
|
+
# Optional, not used for git repositories.
|
49
|
+
attr_accessor :username
|
50
|
+
# (String) Password used to retrieve svn and raw repositories
|
51
|
+
# Optional, not used for git repositories.
|
52
|
+
attr_accessor :password
|
53
|
+
# (String) hash of the CookbookSequence that corresponds to the repo
|
54
|
+
attr_accessor :repo_sha
|
55
|
+
# (Array) List of cookbook <name, position> pairs
|
56
|
+
attr_accessor :positions
|
57
|
+
|
58
|
+
# Initialize fields from given arguments
|
59
|
+
def initialize(*args)
|
60
|
+
@repo_type = args[0]
|
61
|
+
@url = args[1] if args.size > 1
|
62
|
+
@tag = args[2] if args.size > 2
|
63
|
+
@cookbooks_path = args[3] if args.size > 3
|
64
|
+
@ssh_key = args[4] if args.size > 4
|
65
|
+
@username = args[5] if args.size > 5
|
66
|
+
@password = args[6] if args.size > 6
|
67
|
+
@repo_sha = args[7] if args.size > 7
|
68
|
+
@positions = args[8] if args.size > 8
|
69
|
+
end
|
70
|
+
|
71
|
+
# Array of serialized fields given to constructor
|
72
|
+
def serialized_members
|
73
|
+
[ @repo_type, @url, @tag, @cookbooks_path, @ssh_key, @username, @password, @repo_sha, @positions ]
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
+
|
24
|
+
module RightScale
|
25
|
+
|
26
|
+
# List of event categories used by auditor
|
27
|
+
# For now only support generic and security categories
|
28
|
+
class EventCategories
|
29
|
+
|
30
|
+
NONE = 'None'.freeze # No notification
|
31
|
+
CATEGORY_NOTIFICATION = 'Notification'.freeze # Generic notification
|
32
|
+
CATEGORY_SECURITY = 'Security'.freeze # Security topic notification
|
33
|
+
CATEGORY_ERROR = 'Error'.freeze # Error event
|
34
|
+
|
35
|
+
CATEGORIES = [ NONE, CATEGORY_NOTIFICATION, CATEGORY_SECURITY, CATEGORY_ERROR ]
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,130 @@
|
|
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
|
+
|
24
|
+
module RightScale
|
25
|
+
|
26
|
+
# Boot, operation or decommission executable bundle, includes:
|
27
|
+
# * RightScripts with associated packages, parameters and attachments
|
28
|
+
# * Recipes with associated JSON
|
29
|
+
# * Cookbook repositories with associated attributes
|
30
|
+
# * Audit id
|
31
|
+
# Recipes and RightScripts instantiations are interspersed and ordered into one collection
|
32
|
+
# The instance agent can use the audit created by the core agent to audit messages
|
33
|
+
# associated with the processing of the software repositories
|
34
|
+
class ExecutableBundle
|
35
|
+
|
36
|
+
include Serializable
|
37
|
+
|
38
|
+
# (Array) Collection of RightScripts and chef recipes instantiations
|
39
|
+
attr_accessor :executables
|
40
|
+
|
41
|
+
# (Array) Chef cookbook repositories
|
42
|
+
attr_accessor :cookbook_repositories
|
43
|
+
|
44
|
+
# (Integer) ID of corresponding audit entry
|
45
|
+
attr_accessor :audit_id
|
46
|
+
|
47
|
+
# (Boolean) Whether a full or partial converge should be done
|
48
|
+
# Note: Obsolete as of r_s_version 8, kept for backwards compatibility
|
49
|
+
attr_accessor :full_converge
|
50
|
+
|
51
|
+
# (Array) Chef cookbooks
|
52
|
+
attr_accessor :cookbooks
|
53
|
+
|
54
|
+
# (String) Repose server to use
|
55
|
+
attr_accessor :repose_servers
|
56
|
+
|
57
|
+
# (Hash):: collection of repos to be checked out on the instance
|
58
|
+
# :key (String):: the hash id (SHA) of the repository
|
59
|
+
# :value (Hash):: repo and cookbook detail
|
60
|
+
# :repo (Hash):: repo details
|
61
|
+
# {
|
62
|
+
# <Symbol> Type of repository: one of :git, :svn, :download or :local
|
63
|
+
# * :git denotes a 'git' repository that should be retrieved via 'git clone'
|
64
|
+
# * :svn denotes a 'svn' repository that should be retrieved via 'svn checkout'
|
65
|
+
# * :download denotes a tar ball that should be retrieved via HTTP GET (HTTPS if uri starts with https://)
|
66
|
+
# * :local denotes cookbook that is already local and doesn't need to be retrieved
|
67
|
+
# :repo_type => <Symbol>,
|
68
|
+
# <String> URL to repository (e.g. git://github.com/opscode/chef-repo.git)
|
69
|
+
# :url => <String>,
|
70
|
+
# <String> git commit or svn branch that should be used to retrieve repository
|
71
|
+
# Optional, use 'master' for git and 'trunk' for svn if tag is nil.
|
72
|
+
# Not used for raw repositories.
|
73
|
+
# :tag => <String>,
|
74
|
+
# <Array> Path to cookbooks inside repostory
|
75
|
+
# Optional (use location of repository as cookbook path if nil)
|
76
|
+
# :cookbooks_path => <Array>,
|
77
|
+
# <String> Private SSH key used to retrieve git repositories
|
78
|
+
# Optional, not used for svn and raw repositories.
|
79
|
+
# :ssh_key => <String>,
|
80
|
+
# <String> Username used to retrieve svn and raw repositories
|
81
|
+
# Optional, not used for git repositories.
|
82
|
+
# :username => <String>,
|
83
|
+
# <String> Password used to retrieve svn and raw repositories
|
84
|
+
# Optional, not used for git repositories.
|
85
|
+
# :password => <String>
|
86
|
+
# }
|
87
|
+
# :positions (Array):: List of CookbookPositions to be developed. Represents the subset of cookbooks identified as the "dev cookbooks"
|
88
|
+
attr_accessor :dev_cookbooks
|
89
|
+
|
90
|
+
# (RunlistPolicy) The RightLink policy this bundle belongs to
|
91
|
+
attr_accessor :runlist_policy
|
92
|
+
|
93
|
+
# (String) The secret for any instance of the server that generated this bundle.
|
94
|
+
attr_accessor :server_secret
|
95
|
+
|
96
|
+
def initialize(*args)
|
97
|
+
@executables = args[0]
|
98
|
+
@cookbook_repositories = args[1] if args.size > 1
|
99
|
+
@audit_id = args[2] if args.size > 2
|
100
|
+
@full_converge = args[3] if args.size > 3
|
101
|
+
@cookbooks = args[4] if args.size > 4
|
102
|
+
@repose_servers = args[5] if args.size > 5
|
103
|
+
@dev_cookbooks = args[6] if args.size > 6
|
104
|
+
@runlist_policy = args[7] if args.size > 7
|
105
|
+
@server_secret = args[8] if args.size > 8
|
106
|
+
end
|
107
|
+
|
108
|
+
# Array of serialized fields given to constructor
|
109
|
+
def serialized_members
|
110
|
+
[ @executables,
|
111
|
+
@cookbook_repositories,
|
112
|
+
@audit_id,
|
113
|
+
@full_converge,
|
114
|
+
@cookbooks,
|
115
|
+
@repose_servers,
|
116
|
+
@dev_cookbooks,
|
117
|
+
@runlist_policy,
|
118
|
+
@server_secret ]
|
119
|
+
end
|
120
|
+
|
121
|
+
# Human readable representation
|
122
|
+
#
|
123
|
+
# === Return
|
124
|
+
# desc(String):: Auditable description
|
125
|
+
def to_s
|
126
|
+
desc = @executables.collect { |e| e.title }.join(', ') if @executables
|
127
|
+
desc ||= 'empty bundle'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,72 @@
|
|
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
|
+
|
24
|
+
module RightScale
|
25
|
+
|
26
|
+
# List of authorized users for Managed Login feature
|
27
|
+
class LoginPolicy
|
28
|
+
PUBLIC_KEY_REGEXP = /(.*)?(ssh-[a-z]{1,3})\s+(\S+)\s*(.*)?$/
|
29
|
+
|
30
|
+
include Serializable
|
31
|
+
|
32
|
+
attr_accessor :audit_id, :created_at, :exclusive, :users
|
33
|
+
|
34
|
+
# Initialize fields from given arguments
|
35
|
+
def initialize(*args)
|
36
|
+
@audit_id = args[0]
|
37
|
+
@created_at = Time.at( (args[1]||Time.now).to_i )
|
38
|
+
@exclusive = args[2] || false
|
39
|
+
@users = args[3] || []
|
40
|
+
end
|
41
|
+
|
42
|
+
# Array of serialized fields given to constructor
|
43
|
+
def serialized_members
|
44
|
+
[ @audit_id, @created_at.to_i, @exclusive, @users ]
|
45
|
+
end
|
46
|
+
|
47
|
+
# Utility method to parse an SSH2-format public key and return a 4-tuple consisting
|
48
|
+
# of its constituent parts:
|
49
|
+
# * leading comment (optional)
|
50
|
+
# * algorithm (ssh-rsa or ssh-dsa)
|
51
|
+
# * public key material, as a base64 string
|
52
|
+
# * trailing comment or email (optional)
|
53
|
+
#
|
54
|
+
# === Parameters
|
55
|
+
# str(String):: the unparsed public key
|
56
|
+
#
|
57
|
+
# === Return
|
58
|
+
# components (Array|nil):: a 4-tuple of key components, or nil if the key was not a valid public key
|
59
|
+
#
|
60
|
+
def self.parse_public_key(str)
|
61
|
+
match = PUBLIC_KEY_REGEXP.match(str)
|
62
|
+
|
63
|
+
if match
|
64
|
+
#Return a nice array of strings with no leading/trailing whitespace, and empty
|
65
|
+
#strings transformed into nil
|
66
|
+
return match[1..4].map { |x| x.strip! ; x.empty? ? nil : x }
|
67
|
+
else
|
68
|
+
return nil
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,79 @@
|
|
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
|
+
|
24
|
+
require 'net/ssh'
|
25
|
+
|
26
|
+
module RightScale
|
27
|
+
|
28
|
+
# Authorized user for the Managed Login feature
|
29
|
+
class LoginUser
|
30
|
+
|
31
|
+
include Serializable
|
32
|
+
|
33
|
+
attr_accessor :uuid, :username, :public_key, :public_keys, :common_name,
|
34
|
+
:superuser, :expires_at, :profile_data, :public_key_fingerprints
|
35
|
+
|
36
|
+
# Initialize fields from given arguments
|
37
|
+
def initialize(*args)
|
38
|
+
@uuid = args[0]
|
39
|
+
@username = args[1]
|
40
|
+
@public_key = args[2]
|
41
|
+
@common_name = args[3] || ''
|
42
|
+
@superuser = args[4] || false
|
43
|
+
@expires_at = Time.at(args[5]) if args[5] && (args[5] != 0) # nil -> 0 because of expires_at.to_i below
|
44
|
+
@public_keys = args[6]
|
45
|
+
@profile_data = args[7]
|
46
|
+
@public_key_fingerprints = args[8]
|
47
|
+
|
48
|
+
# We now expect an array of public_keys to be passed while supporting the
|
49
|
+
# singular public_key as a legacy member. When serialized back from a
|
50
|
+
# legacy LoginUser record, the singular value may be set while the plural
|
51
|
+
# is nil.
|
52
|
+
if @public_keys
|
53
|
+
raise ArgumentError, "Expected public_keys (seventh argument) to be an array" unless @public_keys.is_a?(Array)
|
54
|
+
@public_key = @public_keys.first
|
55
|
+
else
|
56
|
+
raise ArgumentError, "Expected public_key (third argument) to be a string" unless @public_key.is_a?(String)
|
57
|
+
@public_keys = [@public_key]
|
58
|
+
end
|
59
|
+
|
60
|
+
# The number of fingerprints must match the number of public keys
|
61
|
+
if @public_key_fingerprints && @public_key_fingerprints.size != @public_keys.size
|
62
|
+
raise ArgumentError, "Expected public_keys (seventh argument) array length (#{@public_keys.size}) is not " +
|
63
|
+
"the same as the public_key_fingerprints (eighth argument) (#{@public_key_fingerprints.size})"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Array of serialized fields given to constructor
|
68
|
+
def serialized_members
|
69
|
+
[ @uuid, @username, @public_key, @common_name, @superuser, @expires_at.to_i, @public_keys, @profile_data,
|
70
|
+
@public_key_fingerprints ]
|
71
|
+
end
|
72
|
+
|
73
|
+
# Create fingerprint for public key
|
74
|
+
def self.fingerprint(public_key)
|
75
|
+
Digest::SHA1.hexdigest(::Net::SSH::KeyFactory.load_data_public_key(public_key).to_der)
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 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
|
+
|
24
|
+
module RightScale
|
25
|
+
|
26
|
+
# Represents any details of a planned volume which are needed by the instance
|
27
|
+
# for volume management purposes. A planned volume is a blank, snapshotted or
|
28
|
+
# existing volume which is associated with a server at launch time. It could
|
29
|
+
# also represent a volume which is planned dynamically by the instance itself
|
30
|
+
# as part of a script and which is then guaranteed to be properly managed if
|
31
|
+
# the instance is stopped/started.
|
32
|
+
class PlannedVolume
|
33
|
+
|
34
|
+
include Serializable
|
35
|
+
|
36
|
+
# (String) cloud-specific unique identifier for volume (relative to account
|
37
|
+
# or global)
|
38
|
+
attr_accessor :volume_id
|
39
|
+
|
40
|
+
# (String) cloud-agnostic current known status of the volume. must be nil or
|
41
|
+
# else one of the following:
|
42
|
+
# 'pending', 'attached', 'attaching', 'detached', 'detaching', 'deleted'
|
43
|
+
attr_accessor :volume_status
|
44
|
+
|
45
|
+
# (String) cloud-specific device name for volume (relative to instance)
|
46
|
+
attr_accessor :device_name
|
47
|
+
|
48
|
+
# (Array of String) instance platform-specific mount point(s) for the
|
49
|
+
# physical or virtual disk (which could have multiple partitions) associated
|
50
|
+
# with the planned volume. not all partitions are formatted and/or have a
|
51
|
+
# file system which is compatible with the instance's platform so only valid
|
52
|
+
# partitions are associated with mount points.
|
53
|
+
attr_accessor :mount_points
|
54
|
+
|
55
|
+
def initialize(*args)
|
56
|
+
@volume_id = args[0] if args.size > 0
|
57
|
+
@device_name = args[1] if args.size > 1
|
58
|
+
@mount_points = args[2] if args.size > 2
|
59
|
+
@volume_status = args[3] if args.size > 3
|
60
|
+
end
|
61
|
+
|
62
|
+
# Array of serialized fields given to constructor
|
63
|
+
def serialized_members
|
64
|
+
[ @volume_id, @device_name, @mount_points, @volume_status ]
|
65
|
+
end
|
66
|
+
|
67
|
+
# Determines if this object is valid.
|
68
|
+
#
|
69
|
+
# === Return
|
70
|
+
# result(Boolean):: true if this object is valid, false if required fields are nil or empty
|
71
|
+
def is_valid?
|
72
|
+
result = false == is_blank?(@volume_id) &&
|
73
|
+
false == is_blank?(@device_name) &&
|
74
|
+
false == is_blank?(@volume_status) &&
|
75
|
+
false == is_blank?(@mount_points) &&
|
76
|
+
nil == @mount_points.find { |mount_point| is_blank?(mount_point) }
|
77
|
+
return result
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
# Determines if the given value is nil or empty.
|
83
|
+
#
|
84
|
+
# === Parameters
|
85
|
+
# value(Object):: any value
|
86
|
+
#
|
87
|
+
# === Return
|
88
|
+
# true if value is nil or empty
|
89
|
+
def is_blank?(value)
|
90
|
+
value.nil? || value.empty?
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
end
|