Skip to content

Commit

Permalink
fix: Fix #157
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
  • Loading branch information
adrianriobo committed Nov 22, 2023
1 parent 4c57241 commit b32ada4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/provider/aws/action/fedora/fedora.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
amiSVC "github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/ami"
"github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/keypair"
securityGroup "github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/security-group"
"github.com/adrianriobo/qenvs/pkg/provider/util/command"
"github.com/adrianriobo/qenvs/pkg/provider/util/output"
"github.com/adrianriobo/qenvs/pkg/util"
resourcesUtil "github.com/adrianriobo/qenvs/pkg/util/resources"
Expand Down Expand Up @@ -191,7 +192,7 @@ func (r *Request) deploy(ctx *pulumi.Context) error {
pulumi.String(amiUserDefault))
ctx.Export(fmt.Sprintf("%s-%s", r.Prefix, outputHost),
c.GetHostIP(!r.Airgap))
return c.Readiness(ctx, r.Prefix, awsFedoraDedicatedID,
return c.Readiness(ctx, command.CommandPing, r.Prefix, awsFedoraDedicatedID,
keyResources.PrivateKey, amiUserDefault, bastion, []pulumi.Resource{})
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/provider/aws/action/rhel/rhel.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
amiSVC "github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/ami"
"github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/keypair"
securityGroup "github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/security-group"
"github.com/adrianriobo/qenvs/pkg/provider/util/command"
"github.com/adrianriobo/qenvs/pkg/provider/util/output"
"github.com/adrianriobo/qenvs/pkg/util"
"github.com/adrianriobo/qenvs/pkg/util/file"
Expand Down Expand Up @@ -217,7 +218,7 @@ func (r *Request) deploy(ctx *pulumi.Context) error {
pulumi.String(amiUserDefault))
ctx.Export(fmt.Sprintf("%s-%s", r.Prefix, outputHost),
c.GetHostIP(!r.Airgap))
return c.Readiness(ctx, r.Prefix, awsRHELDedicatedID,
return c.Readiness(ctx, command.CommandCloudInitWait, r.Prefix, awsRHELDedicatedID,
keyResources.PrivateKey, amiUserDefault, bastion, []pulumi.Resource{})
}

Expand Down
3 changes: 2 additions & 1 deletion pkg/provider/aws/action/windows/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
amiSVC "github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/ami"
"github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/keypair"
securityGroup "github.com/adrianriobo/qenvs/pkg/provider/aws/services/ec2/security-group"
"github.com/adrianriobo/qenvs/pkg/provider/util/command"
"github.com/adrianriobo/qenvs/pkg/provider/util/output"
"github.com/adrianriobo/qenvs/pkg/provider/util/security"
"github.com/adrianriobo/qenvs/pkg/util"
Expand Down Expand Up @@ -253,7 +254,7 @@ func (r *Request) deploy(ctx *pulumi.Context) error {
password.Result)
ctx.Export(fmt.Sprintf("%s-%s", r.Prefix, outputHost),
c.GetHostIP(!r.Airgap))
return c.Readiness(ctx, r.Prefix, awsWindowsDedicatedID,
return c.Readiness(ctx, command.CommandPing, r.Prefix, awsWindowsDedicatedID,
keyResources.PrivateKey, r.AMIUser, bastion, []pulumi.Resource{})
}

Expand Down
7 changes: 4 additions & 3 deletions pkg/provider/aws/modules/ec2/compute/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ func (c *Compute) GetHostIP(public bool) (ip pulumi.StringInput) {
return c.LB.DnsName
}

// Check if compute is healthy (ping on ssh)
// Check if compute is healthy based on running a remote cmd
func (compute *Compute) Readiness(ctx *pulumi.Context,
cmd string,
prefix, id string,
mk *tls.PrivateKey, username string,
b *bastion.Bastion,
Expand All @@ -207,8 +208,8 @@ func (compute *Compute) Readiness(ctx *pulumi.Context,
resourcesUtil.GetResourceName(prefix, id, "readiness-cmd"),
&remote.CommandArgs{
Connection: remoteCommandArgs(compute, mk, username, b),
Create: pulumi.String(command.CommandPing),
Update: pulumi.String(command.CommandPing),
Create: pulumi.String(cmd),
Update: pulumi.String(cmd),
}, pulumi.Timeouts(
&pulumi.CustomTimeouts{
Create: command.RemoteTimeout,
Expand Down

0 comments on commit b32ada4

Please sign in to comment.