Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
krystian-panek-vmltech committed Oct 26, 2023
1 parent 351af25 commit 36a5503
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/provider/instance_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ func (ic *InstanceClient) Close() error {

// TODO chown data dir to ssh user or 'aem' user (create him maybe)
func (ic *InstanceClient) prepareDataDir() error {
/* TODO to avoid re-uploading library files (probably temporary)
if _, err := ic.cl.RunShell(fmt.Sprintf("rm -fr %s", ic.DataDir())); err != nil {
return fmt.Errorf("cannot clean up AEM data directory: %w", err)
}
*/
if _, err := ic.cl.RunShell(fmt.Sprintf("mkdir -p %s", ic.DataDir())); err != nil {
return fmt.Errorf("cannot create AEM data directory: %w", err)
}
Expand Down
10 changes: 9 additions & 1 deletion internal/provider/instance_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ func (r *InstanceResource) Create(ctx context.Context, req resource.CreateReques
}
}(ic)

if err := ic.prepareDataDir(); err != nil {
resp.Diagnostics.AddError("Unable to prepare AEM data directory", fmt.Sprintf("%s", err))
return
}
if err := ic.installCompose(); err != nil {
resp.Diagnostics.AddError("Unable to install AEM Compose CLI", fmt.Sprintf("%s", err))
return
}
if err := ic.copyConfigFile(); err != nil {
resp.Diagnostics.AddError("Unable to copy AEM configuration file", fmt.Sprintf("%s", err))
return
Expand Down Expand Up @@ -314,7 +322,7 @@ func (r *InstanceResource) Client(ctx context.Context, data InstanceResourceMode
}

cl.Env["AEM_CLI_VERSION"] = data.Compose.Version.ValueString()
cl.EnvDir = data.Compose.DataDir.ValueString()
cl.EnvDir = "/tmp" // TODO make configurable; or just in user home dir './' ?

if err := cl.SetupEnv(); err != nil {
return nil, err
Expand Down

0 comments on commit 36a5503

Please sign in to comment.