Skip to content

plugin: local steps get no {{ instance.login_user }}, so spore-sync hardcodes ec2-user #1225

Closed

Description

@scttfrdmn

Listed under "Related" in #1130 and not fixed there (PR #1221).

Remote steps get {{ instance.login_user }}: pkg/pluginruntime/runtime.go sets tmplCtx.Instance["login_user"] from spored's local user. pkg/plugin/template.go documents it as "the instance's login user". The controller-side template context in runPluginInstall (cmd/plugin.go) sets only instance.id, instance.name and instance.ip. Local provision, deprovision and reconcile steps therefore render {{ instance.login_user }} as empty.

So spore-plugins' spore-sync hardcodes the user in all three local sections:

ec2-user@{{ instance.ip }}:{{ config.remote_path }}

That breaks on any AMI whose login user is not ec2-user (Ubuntu's is ubuntu).

Fix: populate instance.login_user on the controller from the instance's spawn:local-username tag. resolveInstanceViaSpawn already fetches the tags for lookupInstanceInfo. Persist it in the local record's Instance map so reconcile and deprovision get it too, then switch spore-sync to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions