Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger before action not working #12101

Closed
veics opened this issue Dec 9, 2020 · 4 comments
Closed

Trigger before action not working #12101

veics opened this issue Dec 9, 2020 · 4 comments

Comments

@veics
Copy link

veics commented Dec 9, 2020

Vagrant version

Vagrant 2.2.14

Host operating system

macOS Catalina 10.15.7

Guest operating system

centos/7

Vagrantfile

Vagrant.configure("2") do |config|

  config.trigger.before :"VagrantPlugins::ProviderVirtualBox::Action::CheckGuestAdditions", type: :action do |trigger|
      trigger.warn = "Updating kernel first..."
      trigger.run = {inline: "sudo yum -y update kernel*"}
  end
  config.hostmanager.enabled = true
  config.hostmanager.manage_host = true
  config.hostmanager.manage_guest = true
  [...]
end

Debug output

https://gist.github.com/veics/54b043595dba545c6be5f766e24fc14c

Expected behavior

Should trigger the warning message and run the shell command line.

Actual behavior

==> ubs-ra-dev-local: Waiting for machine to boot. This may take a few minutes...
zzz: SSH address: 127.0.0.1:2222
zzz: SSH username: vagrant
zzz: SSH auth method: private key
zzz:
zzz: Vagrant insecure key detected. Vagrant will automatically replace
zzz this with a newly generated keypair for better security.
zzz:
zzz: Inserting generated public key within guest...
zzz: Removing insecure key from the guest if it's present...
zzz: Key inserted! Disconnecting and reconnecting using new SSH key...
==> zzz: Machine booted and ready!
[zzz] No Virtualbox Guest Additions installation found.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

Steps to reproduce

Create a CentOS box with the latest base box and add the trigger from my Vagrantfile

References

The latest CentOS base box provided by CentOS has an outdated kernel version, while the kernel devel package is not in repos anymore.

Workaround using triggers taken from here: dotless-de/vagrant-vbguest#351
Proof that I'm not the only one encountering this issue: #12095

@soapy1
Copy link
Contributor

soapy1 commented Feb 9, 2021

Hey there,
taking a look at your debug output it seems like this is the correct behavior for Vagrant. Typed triggers are a an experimental Vagrant feature. To enable them set the VAGRANT_EXPERIMENTAL environment variable to typed_triggers.

You can tell that this feature has been enabled when the Vagrant output includes a message like:

==> vagrant: You have requested to enabled the experimental flag with the following features:
==> vagrant: 
==> vagrant: Features:  typed_triggers
==> vagrant: 
==> vagrant: Please use with caution, as some of the features may not be fully
==> vagrant: functional yet.

Once this feature is enabled, then Vagrant should have your desired behavior.

@veics
Copy link
Author

veics commented Feb 9, 2021

Hi @soapy1,

My bad, I have missed this thing. In the meantime I ended up building my own custom vagrant base image.

I will come back trying "typed triggers" as soon as I'll have some spare time.

Thanks!

@soapy1
Copy link
Contributor

soapy1 commented Mar 8, 2021

Hey there,

I am going to close this due to lack of response. If this is still occurring, please open a new issue. Thanks! 😄

@soapy1 soapy1 closed this as completed Mar 8, 2021
@ghost
Copy link

ghost commented Apr 8, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants