File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
stackable-cockpit/src/platform/release Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,11 @@ impl ReleaseSpec {
130130}
131131
132132impl ReleaseList {
133+ /// Checks if a value provided in the '--release' argument is in the release list
134+ pub fn contains ( & self , release : & str ) -> bool {
135+ self . inner ( ) . contains_key ( release)
136+ }
137+
133138 /// Retrieves the latest release from the list and applies a sanity check to the release format.
134139 pub fn latest_release ( & self ) -> Result < String , Error > {
135140 let release = self . inner ( ) . first ( ) . context ( EmptyReleaseListSnafu ) ?. 0 ;
Original file line number Diff line number Diff line change @@ -173,6 +173,9 @@ impl DemoArgs {
173173
174174 let release_branch = match & self . release {
175175 Some ( release) => {
176+ if !release_list. contains ( release) {
177+ return NoSuchReleaseSnafu { name : release } . fail ( ) ;
178+ }
176179 if release == "dev" {
177180 "main" . to_string ( )
178181 } else {
Original file line number Diff line number Diff line change @@ -120,6 +120,9 @@ pub enum CmdError {
120120 #[ snafu( display( "failed to serialize JSON output" ) ) ]
121121 SerializeJsonOutput { source : serde_json:: Error } ,
122122
123+ #[ snafu( display( "no release with name '{name}'" ) ) ]
124+ NoSuchRelease { name : String } ,
125+
123126 #[ snafu( display( "failed to get latest release" ) ) ]
124127 LatestRelease { source : platform:: release:: Error } ,
125128
@@ -155,6 +158,9 @@ impl StackArgs {
155158
156159 let release_branch = match & self . release {
157160 Some ( release) => {
161+ if !release_list. contains ( release) {
162+ return NoSuchReleaseSnafu { name : release } . fail ( ) ;
163+ }
158164 if release == "dev" {
159165 "main" . to_string ( )
160166 } else {
You can’t perform that action at this time.
0 commit comments