Class: RakeCloudspin::Tasks::BaseTask

Inherits:
RakeCloudspin::TaskLib show all
Defined in:
lib/rake_cloudspin/tasks/base_task.rb

Direct Known Subclasses

SshKeyTask, StackTask, StackTestTask

Instance Method Summary collapse

Methods inherited from RakeCloudspin::TaskLib

#check_required, check_required_for, #define, #initialize, parameter, parameter_definitions, #process_arguments, #process_block, #setup_defaults, setup_defaults_for

Constructor Details

This class inherits a constructor from RakeCloudspin::TaskLib

Instance Method Details

#role_user_variable_name(role_name) ⇒ Object



38
39
40
# File 'lib/rake_cloudspin/tasks/base_task.rb', line 38

def role_user_variable_name(role_name)
  "#{role_name}-users"
end

#spin_user_variables(args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rake_cloudspin/tasks/base_task.rb', line 16

def spin_user_variables(args)
  user_variables_hash = {
    'spin_api_users' => []
  }
  api_users = stack_config(args).api_users
  api_users.each { |user_name, user_configuration|
    user_variables_hash['spin_api_users'] << user_name
    if user_configuration.key?('roles')
      user_configuration['roles'].each { |role_name|
        unless user_variables_hash.key?(role_user_variable_name(role_name))
          user_variables_hash[role_user_variable_name(role_name)] = []
        end
        user_variables_hash[role_user_variable_name(role_name)] << user_name
      }
    end
  }
  user_variables_hash.each { |var_name, value_list|
    user_variables_hash[var_name].uniq!
  }
  user_variables_hash
end

#stack_config(args = {}) ⇒ Object



10
11
12
13
14
# File 'lib/rake_cloudspin/tasks/base_task.rb', line 10

def stack_config(args = {})
  configuration
    .for_overrides(args)
    .for_scope(stack_type => stack_name)
end