Class: Staypuft::Deployment::Passwords
Defined Under Namespace
Modules: Mode
Classes: Jail
Constant Summary
collapse
- USER_SERVICES_PASSWORDS =
:admin, :ceilometer_user, :cinder_user, :glance_user, :heat_user,
:heat_cfn_user, :keystone_user, :neutron_user, :nova_user, :swift_user, :amqp
- DB_SERVICES_PASSWORDS =
:cinder_db, :glance_db, :heat_db, :mysql_root, :keystone_db,
:neutron_db, :nova_db, :hacluster
- OTHER_PASSWORDS =
:keystone_admin_token, :ceilometer_metering_secret, :heat_auth_encrypt_key,
:horizon_secret_key, :swift_shared_secret, :neutron_metadata_proxy_secret
- PASSWORD_LIST =
USER_SERVICES_PASSWORDS + DB_SERVICES_PASSWORDS + OTHER_PASSWORDS
- OTHER_ATTRS_LIST =
:mode, :single_password
Instance Attribute Summary
#deployment
Class Method Summary
collapse
Instance Method Summary
collapse
#attributes=, #hostgroup, #marked_for_destruction?
#param_attr, #param_attr_array, #param_scope
Constructor Details
#initialize(deployment) ⇒ Passwords
Returns a new instance of Passwords.
23
24
25
26
|
# File 'app/models/staypuft/deployment/passwords.rb', line 23
def initialize(deployment)
super deployment
self.single_password_confirmation = single_password
end
|
Class Method Details
.param_scope ⇒ Object
17
18
19
|
# File 'app/models/staypuft/deployment/passwords.rb', line 17
def self.param_scope
'passwords'
end
|
Instance Method Details
#effective_value(password_field) ⇒ Object
64
65
66
67
68
69
70
|
# File 'app/models/staypuft/deployment/passwords.rb', line 64
def effective_value(password_field)
if single_mode?
single_password
else
send(password_field)
end
end
|
#id ⇒ Object
compatibility with password_f
72
73
74
|
# File 'app/models/staypuft/deployment/passwords.rb', line 72
def id single_password
end
|
#param_hash ⇒ Object
91
92
93
|
# File 'app/models/staypuft/deployment/passwords.rb', line 91
def param_hash
{ "mode" => mode, "single_password" => single_password}
end
|
#services_passwords(filter = nil) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'app/models/staypuft/deployment/passwords.rb', line 76
def services_passwords(filter=nil)
list = case filter
when :user
USER_SERVICES_PASSWORDS
when :db
DB_SERVICES_PASSWORDS
else
PASSWORD_LIST
end
list.inject({}) do |h,name|
h.update name => single_mode? ? single_password : self.send(name)
end
end
|
#set_defaults ⇒ Object
53
54
55
56
57
58
|
# File 'app/models/staypuft/deployment/passwords.rb', line 53
def set_defaults
self.mode = Mode::RANDOM
PASSWORD_LIST.each do |password_field|
self.send("#{password_field}=", SecureRandom.hex)
end
end
|
#single_mode? ⇒ Boolean
60
61
62
|
# File 'app/models/staypuft/deployment/passwords.rb', line 60
def single_mode?
mode == Mode::SINGLE
end
|