@@ -178,7 +178,6 @@ type StaticCompConfig struct {
178
178
MeshModelName string //Used in Adding ModelName onto Core Meshmodel components. Pass it the same as meshName in OAM components
179
179
URL string //URL
180
180
Method string //Use the constants exported by package. Manifests or Helm
181
- OAMPath string //Where to store the directory.(Each directory will have an array of definitions and schemas)
182
181
MeshModelPath string
183
182
MeshModelConfig MeshModelConfig
184
183
DirName string //The directory's name. By convention, it should be the version name
@@ -188,26 +187,10 @@ type StaticCompConfig struct {
188
187
189
188
// CreateComponents generates components for a given configuration and stores them.
190
189
func CreateComponents (scfg StaticCompConfig ) error {
191
- dirName , err := getLatestDirectory (scfg .OAMPath )
192
- if err != nil {
193
- return ErrCreatingComponents (err )
194
- }
195
190
meshmodeldirName , err := getLatestDirectory (scfg .MeshModelPath )
196
191
if err != nil {
197
192
return ErrCreatingComponents (err )
198
193
}
199
- dir := filepath .Join (scfg .OAMPath , scfg .DirName )
200
- _ , err = os .Stat (dir )
201
- if err != nil && ! os .IsNotExist (err ) {
202
- return ErrCreatingComponents (err )
203
- }
204
- if err != nil && os .IsNotExist (err ) {
205
- err = os .Mkdir (dir , 0777 )
206
- if err != nil {
207
- return ErrCreatingComponents (err )
208
- }
209
- }
210
-
211
194
meshmodelDir := filepath .Join (scfg .MeshModelPath , scfg .DirName )
212
195
_ , err = os .Stat (meshmodelDir )
213
196
if err != nil && ! os .IsNotExist (err ) {
@@ -239,27 +222,11 @@ func CreateComponents(scfg StaticCompConfig) error {
239
222
for i , def := range comp .Definitions {
240
223
schema := comp .Schemas [i ]
241
224
name := getNameFromWorkloadDefinition ([]byte (def ))
242
- defFileName := name + "_definition.json"
243
- schemaFileName := name + ".meshery.layer5io.schema.json"
244
225
meshmodelFileName := name + "_meshmodel.json"
245
226
err = createMeshModelComponentsFromLegacyOAMComponents ([]byte (def ), schema , filepath .Join (meshmodelDir , meshmodelFileName ), scfg .MeshModelName , scfg .MeshModelConfig )
246
227
if err != nil {
247
228
return ErrCreatingComponents (err )
248
229
}
249
-
250
- err := writeToFile (filepath .Join (dir , defFileName ), []byte (def ), scfg .Force )
251
- if err != nil {
252
- return ErrCreatingComponents (err )
253
- }
254
- err = writeToFile (filepath .Join (dir , schemaFileName ), []byte (schema ), scfg .Force )
255
- if err != nil {
256
- return ErrCreatingComponents (err )
257
- }
258
- }
259
- //For OAM components
260
- err = copyCoreComponentsToNewVersion (filepath .Join (scfg .OAMPath , dirName ), filepath .Join (scfg .OAMPath , scfg .DirName ), scfg .DirName , false )
261
- if err != nil {
262
- return ErrCreatingComponents (err )
263
230
}
264
231
//For Meshmodel components
265
232
err = copyCoreComponentsToNewVersion (filepath .Join (scfg .MeshModelPath , meshmodeldirName ), filepath .Join (scfg .MeshModelPath , scfg .DirName ), scfg .DirName , true )
0 commit comments