Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add service_properties constant to node properties #1268

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/concerns/node_properties.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ def self.included(base)
end

SERVICE_KEYS = %i[protocol port state product reason name version]
SERVICE_PROPERTIES = %w[services services_extras]

# -------------------------------------------- Individual property management
# Sets a property, storing value as Array when needed
# and taking care of duplications
def set_property(key, value)
if [:services, :services_extras].include?(key.to_sym) # let's get defensive
if SERVICE_PROPERTIES.include?(key.to_s) # let's get defensive
raise ArgumentError, 'don\'t use set_property for :services or '\
':services_extras, use set_service instead'
end
Expand Down Expand Up @@ -101,7 +102,6 @@ def set_service(data)
end
end


# -------------------------------------- :raw_properties accessors for the UI
def raw_properties
if self.has_any_property?
Expand Down
Loading