@@ -27,12 +27,13 @@ import (
2727)
2828
2929var (
30- deployProvider string
31- deployOffer string
32- deployMachine string
33- deployTerm string
34- deployTermCount uint64
35- deployForce bool
30+ deployProvider string
31+ deployOffer string
32+ deployMachine string
33+ deployTerm string
34+ deployTermCount uint64
35+ deployForce bool
36+ deployShowOffers bool
3637
3738 deployCmd = & cobra.Command {
3839 Use : "deploy" ,
@@ -106,6 +107,12 @@ var (
106107
107108 fmt .Printf ("Using provider: %s (%s)\n " , machine .Provider , providerAddr )
108109
110+ if deployShowOffers {
111+ // Display all offers supported by the provider.
112+ showProviderOffers (ctx , npa , conn , * providerAddr )
113+ return
114+ }
115+
109116 // Push ORC to OCI repository.
110117 if deployment .OCIRepository == "" {
111118 // TODO: Support default OCI repository.
@@ -137,11 +144,6 @@ var (
137144 // When machine is not set, we need to obtain one.
138145 fmt .Printf ("No pre-existing machine configured, creating a new one...\n " )
139146
140- if machine .Offer == "" && deployOffer == "" {
141- // Display all offers supported by the provider.
142- showProviderOffers (ctx , npa , conn , * providerAddr )
143- cobra .CheckErr (fmt .Sprintf ("Offer not configured for deployment '%s' machine '%s'. Please specify --offer." , deploymentName , deployMachine ))
144- }
145147 if deployOffer != "" {
146148 machine .Offer = deployOffer
147149 }
@@ -154,7 +156,8 @@ var (
154156 }
155157 var offer * roflmarket.Offer
156158 for _ , of := range offers {
157- if of .Metadata [provider .SchedulerMetadataOfferKey ] == machine .Offer {
159+ if of .Metadata [provider .SchedulerMetadataOfferKey ] == machine .Offer || machine .Offer == "" {
160+ machine .Offer = of .Metadata [provider .SchedulerMetadataOfferKey ]
158161 offer = of
159162 break
160163 }
@@ -324,6 +327,7 @@ func init() {
324327 providerFlags .StringVar (& deployTerm , "term" , "" , "term to pay for in advance" )
325328 providerFlags .Uint64Var (& deployTermCount , "term-count" , 1 , "number of terms to pay for in advance" )
326329 providerFlags .BoolVar (& deployForce , "force" , false , "force deployment" )
330+ providerFlags .BoolVar (& deployShowOffers , "show-offers" , false , "show all provider offers and quit" )
327331
328332 deployCmd .Flags ().AddFlagSet (common .SelectorFlags )
329333 deployCmd .Flags ().AddFlagSet (common .RuntimeTxFlags )
0 commit comments