Icinga / icinga-vagrant

Vagrant boxes for Icinga 2, Icinga Web 2, modules, themes and integrations (Graphite, InfluxDB, Elastic, Graylog, etc.)
https://icinga.com/products/demo/
GNU General Public License v2.0
249 stars 83 forks source link

Vagrant Up Fails with 'Undefined Local Variable Or Method' #166

Closed pauby closed 6 years ago

pauby commented 6 years ago

Not much to say. Tried running a vagrant up and get the error.

Bringing machine 'icinga2' up with 'virtualbox' provider...
==> icinga2: Cloning VM...
==> icinga2: Matching MAC address for NAT networking...
==> icinga2: Checking if box 'bento/centos-7' is up to date...
==> icinga2: Setting the name of the VM: icinga2
==> icinga2: Clearing any previously set network interfaces...
==> icinga2: Preparing network interfaces based on configuration...
    icinga2: Adapter 1: nat
    icinga2: Adapter 2: hostonly
==> icinga2: Forwarding ports...
    icinga2: 443 (guest) => 8445 (host) (adapter 1)
    icinga2: 8003 (guest) => 8085 (host) (adapter 1)
    icinga2: 22 (guest) => 2085 (host) (adapter 1)
    icinga2: 22 (guest) => 2222 (host) (adapter 1)
==> icinga2: Running 'pre-boot' VM customizations...
==> icinga2: Booting VM...
==> icinga2: Waiting for machine to boot. This may take a few minutes...
    icinga2: SSH address: 127.0.0.1:2222
    icinga2: SSH username: vagrant
    icinga2: SSH auth method: private key
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Remote connection disconnect. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Remote connection disconnect. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Remote connection disconnect. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2: Warning: Connection reset. Retrying...
    icinga2: Warning: Connection aborted. Retrying...
    icinga2:
    icinga2: Vagrant insecure key detected. Vagrant will automatically replace
    icinga2: this with a newly generated keypair for better security.
    icinga2:
    icinga2: Inserting generated public key within guest...
    icinga2: Removing insecure key from the guest if it's present...
    icinga2: Key inserted! Disconnecting and reconnecting using new SSH key...
==> icinga2: Machine booted and ready!
==> icinga2: Checking for guest additions in VM...
==> icinga2: Setting hostname...
==> icinga2: Configuring and enabling network interfaces...
    icinga2: SSH address: 127.0.0.1:2222
    icinga2: SSH username: vagrant
    icinga2: SSH auth method: private key
==> icinga2: Mounting shared folders...
    icinga2: /vagrant => C:/gitrepo/pauby/others/icinga-vagrant/standalone
    icinga2: /hieradata => C:/gitrepo/pauby/others/icinga-vagrant/.puppet/hieradata
    icinga2: /tmp/vagrant-puppet/environments => C:/gitrepo/pauby/others/icinga-vagrant/standalone/environments
    icinga2: /tmp/vagrant-puppet/modules-1390aff08d1dc79ae32241f76ac79678 => C:/gitrepo/pauby/others/icinga-vagrant/.puppet/modules
==> icinga2: Running provisioner: shell...
    icinga2: Running: inline script
    icinga2: Restarting network (via systemctl):
    icinga2: [  OK  ]
==> icinga2: Running provisioner: shell...
    icinga2: Running: C:/Users/Paul/AppData/Local/Temp/vagrant-shell20181025-13480-wy9qxp.sh
    icinga2: Running initial upgrade
    icinga2: Installing Puppet 5 release repository...
    icinga2: Loaded plugins: fastestmirror
    icinga2: Examining /var/tmp/yum-root-vHyPFW/puppet5-release-el-7.noarch.rpm: puppet5-release-5.0.0-4.el7.noarch
    icinga2: Marking /var/tmp/yum-root-vHyPFW/puppet5-release-el-7.noarch.rpm to be installed
    icinga2: Resolving Dependencies
    icinga2: --> Running transaction check
    icinga2: ---> Package puppet5-release.noarch 0:5.0.0-4.el7 will be installed
    icinga2: --> Finished Dependency Resolution
    icinga2:
    icinga2: Dependencies Resolved
    icinga2:
    icinga2: ================================================================================
    icinga2:  Package           Arch     Version        Repository                      Size
    icinga2: ================================================================================
    icinga2: Installing:
    icinga2:  puppet5-release   noarch   5.0.0-4.el7    /puppet5-release-el-7.noarch   2.1 k
    icinga2:
    icinga2: Transaction Summary
    icinga2: ================================================================================
    icinga2: Install  1 Package
    icinga2:
    icinga2: Total size: 2.1 k
    icinga2: Installed size: 2.1 k
    icinga2: Downloading packages:
    icinga2: Running transaction check
    icinga2: Running transaction test
    icinga2: Transaction test succeeded
    icinga2: Running transaction
    icinga2:   Installing : puppet5-release-5.0.0-4.el7.noarch                           1/1
    icinga2:
    icinga2:   Verifying  : puppet5-release-5.0.0-4.el7.noarch                           1/1
    icinga2:
    icinga2:
    icinga2: Installed:
    icinga2:   puppet5-release.noarch 0:5.0.0-4.el7
    icinga2: Complete!
    icinga2: Installing Puppet 5...
    icinga2: Loaded plugins: fastestmirror
    icinga2: Determining fastest mirrors
    icinga2:  * base: mirror.vorboss.net
    icinga2:  * extras: mirrors.clouvider.net
    icinga2:  * updates: mirrors.clouvider.net
    icinga2: Resolving Dependencies
    icinga2: --> Running transaction check
    icinga2: ---> Package puppet-agent.x86_64 0:5.5.7-1.el7 will be installed
    icinga2: --> Finished Dependency Resolution
    icinga2:
    icinga2: Dependencies Resolved
    icinga2:
    icinga2: ================================================================================
    icinga2:  Package              Arch           Version              Repository       Size
    icinga2: ================================================================================
    icinga2: Installing:
    icinga2:  puppet-agent         x86_64         5.5.7-1.el7          puppet5          20 M
    icinga2:
    icinga2: Transaction Summary
    icinga2: ================================================================================
    icinga2: Install  1 Package
    icinga2: Total download size: 20 M
    icinga2: Installed size: 20 M
    icinga2: Downloading packages:
    icinga2: Public key for puppet-agent-5.5.7-1.el7.x86_64.rpm is not installed
    icinga2: warning: /var/cache/yum/x86_64/7/puppet5/packages/puppet-agent-5.5.7-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID ef8d349f: NOKEY
    icinga2: Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppet5-release
    icinga2: Importing GPG key 0xEF8D349F:
    icinga2:  Userid     : "Puppet, Inc. Release Key (Puppet, Inc. Release Key) <release@puppet.com>"
    icinga2:  Fingerprint: 6f6b 1550 9cf8 e59e 6e46 9f32 7f43 8280 ef8d 349f
    icinga2:  Package    : puppet5-release-5.0.0-4.el7.noarch (installed)
    icinga2:  From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-puppet5-release
    icinga2: Running transaction check
    icinga2: Running transaction test
    icinga2: Transaction test succeeded
    icinga2: Running transaction
    icinga2:   Installing : puppet-agent-5.5.7-1.el7.x86_64                              1/1
    icinga2:
    icinga2:   Verifying  : puppet-agent-5.5.7-1.el7.x86_64                              1/1
    icinga2:
    icinga2:
    icinga2: Installed:
    icinga2:   puppet-agent.x86_64 0:5.5.7-1.el7
    icinga2: Complete!
==> icinga2: Running provisioner: puppet...
==> icinga2: Running Puppet with environment vagrant...
==> icinga2: Notice: Scope(Class[Selinux::Config]): A reboot is required to fully disable SELinux. SELinux will operate in Permissive mode until a reboot
==> icinga2: Error: Evaluation Error: Error while evaluating a Function Call, undefined local variable or method `created' for Puppet::Pops::Loader::RubyLegacyFunctionInstantiator:Class
==> icinga2: Did you mean?  create (file: /tmp/vagrant-puppet/modules-1390aff08d1dc79ae32241f76ac79678/mysql/manifests/server.pp, line: 52, column: 14) on node icinga2.vagrant.demo.icinga.com
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Expected Behavior

It should just work.

Current Behavior

Vagrant up produces the error above.

Steps to Reproduce (for bugs)

Run a vagrant up

Context

Your Environment

dnsmichi commented 6 years ago

Seems like a regression/change in Puppet 5.5.7.

https://gist.github.com/baurmatt/86ea02c0fd6dd173efab4a7bb7ddf23e

pauby commented 6 years ago

One of the problems of relying on external tools.

dnsmichi commented 6 years ago

Seriously not helpful at all. Can you do better?

pauby commented 6 years ago

That's not quite the reaction I was expecting. Nor was it my intention to suggest I could do better.

My thought on this were that as you're providing a Vagrant environment for people to spin up and use as a demo I expect it to be as self-contained as possible. You control it all. That way you also control, and have the ability to fix any issues. Demo environments are spun up on all sorts of kit so your environment needs to take care of that. So when it's built you know that no matter where it goes, it works. Minimising the dependencies you don't control, in my mind, is part of that. It means that you're not reliant on something that could stop you dead in your tracks, as this has done for me (I'm assuming at this point there is no workaround as there wasn't one offered).

When I saw the Vagrant environment my initial thoughts were 'why are they using Puppet when they know how it hangs together'. It just looks a little strange from an outsider to come along to your product and see you're using something else entirely to install it. Why not just script is yourselves that way you take that dependency away?

When I'm evaluating using a tool, and the demo doesn't work, and I take the time to report it, what I'm not expecting is somebody to complain and ask me if I can do better. What it says to me, and anybody else seeing this is that why would they bother reporting issues?

You can either take from that, that I'm having a go or you can take from that as honest feedback. That's entirely up to you. I know what my intention was and raising an issue is not something I do lightly. Unless there is a workaround for the issue I'll leave this as it is and move on.

dnsmichi commented 6 years ago

It is unfortunate that a Puppet minor version breaks this, but it is like anything else with open source - you're welcome to help resolve the issue, or have to wait until things are fixed. Thanks for raising the issue, I'll look into it when I get the time to.

Things I cannot stand are comments like yours, as it doesn't help with anything except for the feeling that one should not use Puppet. That doesn't help me nor you to get things working again. I hope you see my point here.

Meanwhile, you can try pinning the Puppet version in the provisioner scripts to 5.5.6.

diff --git a/.puppet/scripts/shell_provisioner_pre.sh b/.puppet/scripts/shell_provisioner_pre.sh
index d4acad5cf..226f5c9f2 100755
--- a/.puppet/scripts/shell_provisioner_pre.sh
+++ b/.puppet/scripts/shell_provisioner_pre.sh
@@ -37,7 +37,7 @@ fi

 if ! rpm -q "puppet-agent" &>/dev/null; then
     echo "Installing Puppet 5..."
-    yum install -y puppet-agent
+    yum install -y puppet-agent-5.5.6
 fi

 if [ `getenforce` = 'Enforcing' ]; then
pauby commented 6 years ago

I'm feeling like I'm misunderstanding this repo. My understanding was that it's a demo environment to show off the product and what it can do? It's linked from the main Icinga website. I get that it's open source but when I come here from your website I'm expecting a certain level of functionality. So while I get it's open source, it should also work, in my opinion, without customers coming along to fix them. This is entirely different from the product itself. It's my expectation of the demo repo. It would not be my expectation of the repo for the product itself - been around open source a long time so I get it. Again, that's not me having a go.

Things I cannot stand are comments like yours, as it doesn't help with anything except for the feeling that one should not use Puppet. That doesn't help me nor you to get things working again. I hope you see my point here.

I absolutely do see your point here but it wasn't a comment aimed at not using Puppet (although I've made my feeling known on that). However what I hate is comments that are knee jerk reactions to other comments when there is nothing in the history to show what the meaning behind that comment was. Now that's a mouthful. Had there been a thread of 'nice' or 'not nice' comments, you'd have rightfully judged it one way or the other. But you didn't know what the intention was. Nor did you try and find out.

But that's done. We've both said our piece so let's leave that there.

Actually what my intention really was me sympathising with the issue of external dependencies screwing up your builds.

I will look at pinning the Puppet version in the diff but can I also suggest you do that for your environment? As this is a demo environment then the intention, I assume, is to just show off the product. So as an end user I only want to see what it can do. As a provider of that environment you want to provide a working environment. You know it works with that version of Puppet. Unless you want to test your environment every time Puppet releases a new version (or every time any other depending you use releases a new environment - you can only be sure it works if you do do that testing) then you need to pin it to a known working version. As I said, this is a demo environment so the latest functionality in Puppet is unnecessary.

dnsmichi commented 6 years ago

I wasn't aware that I would need to pin Puppet versions in the 5.x branch - this has worked for many years. As a quickfix, I will do so ... hopefully Icinga 2 compiles in that PR I am working on, so I may fire vagrant up myself meanwhile.

So, I guess I was wrong with my assumptions, sorry for the harsh reaction. We don't know each other in person, maybe never will, so always is hard to understand each other. Likewise, you're fluent in English, I am not.

Cheers, Michael

pauby commented 6 years ago

So, I guess I was wrong with my assumptions, sorry for the harsh reaction. We don't know each other in person, maybe never will, so always is hard to understand each other. Likewise, you're fluent in English, I am not.

That's something I wasn't aware of. Your written English certainly doesn't give that away!

I wasn't aware that I would need to pin Puppet versions in the 5.x branch - this has worked for many years.

I completely get that you've never had to do it. But this would help with what I said about minimising the need for dependencies. If you do continue to use Puppet then you have absolutely no idea if any future version of Puppet will break your build. This case it was a minor version but the build would have installed v6 when it comes along and that has a far higher chance of breaking things. You know it works with 5.5.6 so pin it to that and you don't have to worry about it. It's a known. v5.5.6.1 and newer are unknown.

It's a win for you as you know that version works so no issues like mine. It's a win for Icinga as you don't have another customer complaining about it not working, or jumping to Nagios (or whatever other solution) because your environment didn't work so "why should they bother trying it out when you can't get the basics right" (customers do think like this). It's a win for the techie who decides to show all this shiny stuff to their boss, and they build the Vagrant environment in front of them only to discover that Puppet has released another version that breaks everything between them trying it and demoing to the boss.

Pinning the version numbers takes your Vagrant environment from an unknown every time it's built to a known.

And this applies to any dependencies not just Puppet.

And finally I'm happy to report that the Vagrant build is continuing beyond where it failed last time after I made the change. So, thank you for that.

dnsmichi commented 6 years ago

Thanks for the help and testing :) I wasn't really aware that this environment is used by the many to evaluate Icinga ... feedback is received mostly when things don't work. One problem I do see with this environment: I did build and maintain it for many years now, and it more or less contains too many things to show and maintain. It doesn't break that often though.

Some versions are not pinned in there, like for Icinga itself where the Puppet module doesn't allow for it. For now, this environment also is used to generate feedback from users with using snapshots, but I tend to disable this in Hiera (the docs tell you how to use release packages with a short edit).

The Puppet modules themselves are safe, as they are a fixed Git subtree and not the usual way one would keep to install Puppet modules. Some don't like that, but it keeps this more safe than deprecated/removed modules from the forge.

Also, thanks for the kind feedback on my English :)

dnsmichi commented 6 years ago

Seems this change causes this: https://tickets.puppetlabs.com/browse/PUP-9137

dnsmichi commented 6 years ago

https://github.com/puppetlabs/puppetlabs-mysql/blob/master/CHANGELOG.md#added-2

Use puppet4 functions-api puppetlabs/puppetlabs-mysql#1044 (juliantodt)

I'm on 5.1.0, not 6.0.0.

dnsmichi commented 6 years ago

While testing, I've found icinga/icinga2#6635 happening more visible.

pauby commented 6 years ago

@dnsmichi I would be happy to help out if you were thinking of migrating this away from Puppet onto standard scripts (I know we've had that discussion and it's unlikely but I'm just letting you know).

dnsmichi commented 6 years ago

I'm fine with Puppet, thanks. I'm just looking to solve the real issue and learn from it. At some point, one likely wants to use new features from modules, and really needs Puppet 6 support. For myself, I've found the DSL easier than shell scripting or Ansible/Chef. It also keeps me in the loop with automation tools, things I would otherwise never learn.

dnsmichi commented 6 years ago

Plus, Puppet tends to speed up things in minor releases, so this is a good opportunity to update things too.