From 4a6926f5e6b784ec08c461f14fa95b7fbb7a540c Mon Sep 17 00:00:00 2001 From: platon Date: Thu, 10 Nov 2016 09:35:25 +0000 Subject: [PATCH] Fix riak-version urls from local to config values --- src/rms_resources.erl | 8 ++++---- src/rms_wm_helper.erl | 12 ++++++------ src/rms_wm_resource.erl | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/rms_resources.erl b/src/rms_resources.erl index 2d27354..63c3d86 100644 --- a/src/rms_resources.erl +++ b/src/rms_resources.erl @@ -22,7 +22,7 @@ -export([init_artifacts/4, artifact_urls/2, - riak_artifact_urls/1, + riak_urls/1, riak_root_path/2]). -define(EXCLUDE_ARTIFACT_KEYS, ["scheduler"]). @@ -56,9 +56,9 @@ artifact_urls(BaseUrl, ResourceUrls) -> Artifacts = artifacts(ResourceUrls), [{Key, BaseUrl ++ Package} || {Key, Package} <- Artifacts]. --spec riak_artifact_urls([{string(), string()}]) -> [{string(), string()}]. -riak_artifact_urls(ArtifactUrls) -> - [ArtifactUrl || {Key, _Url} = ArtifactUrl <- ArtifactUrls, +-spec riak_urls([{string(), string()}]) -> [{string(), string()}]. +riak_urls(ResourceUrls) -> + [ResourceUrl || {Key, _Url} = ResourceUrl <- ResourceUrls, case Key of "riak-" ++ _Version -> true; diff --git a/src/rms_wm_helper.erl b/src/rms_wm_helper.erl index a5788e3..651e69a 100644 --- a/src/rms_wm_helper.erl +++ b/src/rms_wm_helper.erl @@ -20,7 +20,7 @@ -module(rms_wm_helper). --export([riak_artifact_urls/0, +-export([riak_urls/0, cluster_exists/1, cluster_riak_config_exists/1, cluster_advanced_config_exists/1, @@ -56,10 +56,10 @@ %% External functions. --spec riak_artifact_urls() -> [{string(), string()}]. -riak_artifact_urls() -> - {ok, ArtifactUrls} = rms_metadata:get_option(artifact_urls), - rms_resources:riak_artifact_urls(ArtifactUrls). +-spec riak_urls() -> [{string(), string()}]. +riak_urls() -> + ResourceUrls = rms_config:resource_urls(), + rms_resources:riak_urls(ResourceUrls). -spec cluster_exists(rms_cluster:key()) -> boolean(). cluster_exists(ClusterKey) -> @@ -214,7 +214,7 @@ from_json(Value, _Options) -> -spec validate_riak_version(string()) -> boolean(). validate_riak_version(RiakVersion) -> - case lists:keymember(RiakVersion, 1, riak_artifact_urls()) of + case lists:keymember(RiakVersion, 1, riak_urls()) of true -> ok; false -> diff --git a/src/rms_wm_resource.erl b/src/rms_wm_resource.erl index da18885..16f698d 100644 --- a/src/rms_wm_resource.erl +++ b/src/rms_wm_resource.erl @@ -237,7 +237,7 @@ static_file(ReqData) -> %% Riak versions. riak_versions(ReqData) -> - JsonRiakUrls = rms_wm_helper:to_json(rms_wm_helper:riak_artifact_urls()), + JsonRiakUrls = rms_wm_helper:to_json(rms_wm_helper:riak_urls()), {[{riak_versions, JsonRiakUrls}], ReqData}. %% Clusters.