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
Modularize puppet logic into classes #2349
Comments
The following https://bpaste.net/show/45016ab334a7 link may not exist, so we paste it below:
IRC #puppet (02/24/16 ~ 11:15pm EST):
|
The following general solution will work:
Note: typically, manifest(s), and module(s) should go in the ## script1.pp
class medium::script1 {
...
} ## default.pp
include medium::script1
|
If we implement the following
Then, we get modules defined from our $ git status
On branch feature-xxxx
Untracked files:
(use "git add <file>..." to include in what will be committed)
puppet/stig/modules/some_module/
puppet/stig/modules/another_module/
puppet/stig/modules/third_module/
puppet/stig/modules/etc_module/
no changes added to commit (use "git add" and/or "git commit -a") Along with the following ...
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment global...
==> default: Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::medium::script1 for localhost.localdomain at /tmp/vagrant-puppet/manifests-a53f720de1108e13b0061de0d965bfa5/default.pp:xx:xx on node localhost.localdomain
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. |
Similarly, if we implement the following
Then, we get modules defined from our Puppetfile, replacing our current module manifests: $ git status
On branch feature-xxx
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: puppet/global/modules/high/manifests/script3.pp
deleted: puppet/global/modules/high/manifests/script4.pp
deleted: puppet/global/modules/medium/manifests/script1.pp
deleted: puppet/global/modules/medium/manifests/script2.pp
Untracked files:
(use "git add <file>..." to include in what will be committed)
puppet/stig/modules/some_module/
puppet/stig/modules/another_module/
puppet/stig/modules/third_module/
puppet/stig/modules/etc_module/
no changes added to commit (use "git add" and/or "git commit -a") Along with the same ...
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment global...
==> default: Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::medium::script1 for localhost.localdomain at /tmp/vagrant-puppet/manifests-a53f720de1108e13b0061de0d965bfa5/default.pp:xx:xx on node localhost.localdomain
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.
... |
Finally, if we implement the following
Then, no error traceback exists following $ cd puppet/global/modules
$ ls
contrib high medium |
Later, if we add additional manifest references within the
We will get the following error: ...
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment development...
==> default: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/environments.rb:38:in `get!': Could not find a directory environment named 'development' anywhere in the path: /tmp/vagrant-puppet/environments. Does the directory exist? (Puppet::Environments::EnvironmentNotFound)
==> default: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application_support.rb:29:in push_application_context'
==> default: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:337:in `run'
==> default: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:128:in `run'
==> default: from /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:72:in `execute'
==> default: from /opt/puppetlabs/bin/puppet:5:in `<main>'
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. |
To eliminate the latest errors, we need to restructure our
Then, we can keep our puppet manifests the same: ## script1.pp
class medium::script1 {
...
} ## default.pp
include medium::script1 However, the above directory structure, and puppet manifests, would require the following
|
Commenting out corresponding manifests from the ...
class package::webcompilers {
## variables
$webcompilers = [
'uglify-js',
'imagemin',
'node-sass',
'babel-core',
'browserify',
'babelify'
]
exec { 'echo-versions':
command => 'npm -v && node -v',
path => '/usr/bin',
before => Package[$webcompilers],
logoutput => true,
}
## packages: install general packages (npm)
package { $webcompilers:
ensure => 'present',
provider => 'npm',
}
} Otherwise, we get the following error traceback: ...
==> default: Running provisioner: puppet...
==> default: Running Puppet with environment development...
==> default: stdin: is not a tty
==> default: Notice: Compiled catalog for vagrant-ubuntu-trusty-64.home in envir
onment development in 1.84 seconds
==> default: Notice: /Stage[main]/Package::Webcompilers/Exec[echo-general-notice
]/returns: installing npm packages with:
==> default: Notice: /Stage[main]/Package::Webcompilers/Exec[echo-general-notice
]/returns: executed successfully
==> default: Notice: /Stage[main]/Package::Webcompilers/Exec[echo-versions]/retu
rns: 3.7.3
==> default: Notice: /Stage[main]/Package::Webcompilers/Exec[echo-versions]/retu
rns: v5.8.0
==> default: Notice: /Stage[main]/Package::Webcompilers/Exec[echo-versions]: Tri
ggered 'refresh' from 1 events
==> default: Notice: /Stage[main]/Package::Webcompilers/Package[uglify-js]/ensur
e: created
==> default: Error: Execution of '/usr/bin/npm install --global imagemin' return
ed 1: > optipng-bin@3.1.0 postinstall /usr/lib/node_modules/imagemin/node_module
s/optipng-bin
==> default: > node lib/install.js
==> default: Error: /Stage[main]/Package::Webcompilers/Package[imagemin]/ensure:
change from absent to present failed: Execution of '/usr/bin/npm install --glob
al imagemin' returned 1: > optipng-bin@3.1.0 postinstall /usr/lib/node_modules/i
magemin/node_modules/optipng-bin
==> default: > node lib/install.js
==> default: Error: Execution of '/usr/bin/npm install --global node-sass' retur
ned 1: npm WARN deprecated npmconf@2.1.2: this package has been reintegrated int
o npm and is now out of date with respect to npm
==> default: npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer mainta
ined. Upgrade to lodash@^4.0.0.
==> default: npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and be
fore will fail on newer node releases. Please update to graceful-fs@^4.0.0 as so
on as possible.
==> default: /usr/bin/node-sass -> /usr/lib/node_modules/node-sass/bin/node-sass
==> default:
==> default: > node-sass@3.4.2 install /usr/lib/node_modules/node-sass
==> default: > node scripts/install.js
==> default: Error: /Stage[main]/Package::Webcompilers/Package[node-sass]/ensure
: change from absent to present failed: Execution of '/usr/bin/npm install --glo
bal node-sass' returned 1: npm WARN deprecated npmconf@2.1.2: this package has b
een reintegrated into npm and is now out of date with respect to npm
==> default: npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer mainta
ined. Upgrade to lodash@^4.0.0.
==> default: npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and be
fore will fail on newer node releases. Please update to graceful-fs@^4.0.0 as so
on as possible.
==> default: /usr/bin/node-sass -> /usr/lib/node_modules/node-sass/bin/node-sass
... |
When commenting out the following portions of the
The associated webcompiler logic runs, without producing any error traceback:
Therefore, we need to determine if we can narrow the error to a single manifest:
Then, we can attempt a build, by placing the latter two manifest (or the single manifest culprit), after all other manifests declarations, within the |
We ran a
So, we will place the database manifest, after all other manifest references, within the Note: we should create a separate issue to further debug the above condition. |
We've placed the
|
#2349: Modularize puppet logic into classes
We need to modularize all of our puppet manifests, into classes, and possibly modules.
Note: this should be similar to several manifests found within drupal-demonstration.
The text was updated successfully, but these errors were encountered: