ayohrling / local_security_policy

Apache License 2.0
6 stars 28 forks source link

Could not autoload puppet/type/local_security_policy: undefined method 'path for nil:NilClass #21

Closed Randy2009 closed 7 years ago

Randy2009 commented 7 years ago

Hi, i tried to use the module, but won't get it to work. This is the trace file,

Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/local_security_policy: undefined method path' for nil:NilClass at /etc/puppetlabs/code/environments/test/modules/base/manifests/mssql.pp:16:5 on node test01.test.lab C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/indirector/rest.rb:208:inis_http_200?' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/indirector/rest.rb:106:infind' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/indirector/indirection.rb:194:infind' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:377:in block in retrieve_new_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:386:inblock in thinmark' C:/Program Files/Puppet Labs/Puppet/sys/ruby/lib/ruby/2.1.0/benchmark.rb:294:inrealtime' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:385:inthinmark' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:376:in retrieve_new_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:78:inretrieve_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:147:in prepare_and_retrieve_catalog' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:281:inrun_internal' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:186:in block in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/context.rb:65:inoverride' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet.rb:240:in override' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/configurer.rb:185:inrun' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent.rb:45:in block (4 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent/locker.rb:21:inlock' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent.rb:45:in block (3 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent.rb:98:inwith_client' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent.rb:42:in block (2 levels) in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent.rb:65:inrun_in_fork' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent.rb:41:in block in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:179:incall' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:179:in controlled_run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/agent.rb:39:inrun' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/agent.rb:353:in onetime' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application/agent.rb:331:inrun_command' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:344:in block in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util.rb:540:inexit_on_fail' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/application.rb:344:in run' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:128:inrun' C:/Program Files/Puppet Labs/Puppet/puppet/lib/puppet/util/command_line.rb:72:in execute' C:/Program Files/Puppet Labs/Puppet/puppet/bin/puppet:5:in

' Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

Any clue what is going wrong?

ayohrling commented 7 years ago

I take it you ran the module install on your Puppetserver and the module is installed in for the test environment? Can you share this file? /etc/puppetlabs/code/environments/test/modules/base/manifests/mssql.pp

ripclawffb commented 7 years ago

Having a similar issue:

My hiera looks like this: profile::local_security::cfg: 'Log on as a service': ensure: 'present' policy_value: 'Administrators, IIS APPPOOL\NET v4.5, IIS APPPOOL\NET v4.5 Classic, IIS APPPOOL\DefaultAppPool, NT SERVICE\ALL SERVICES'

My manifest looks like: class profile::local_security {

hiera lookups

$cfg = hiera('profile::local_security::cfg')

validate lookup

validate_hash($cfg)

create resources for each policy

create_resources(local_security_policy,$cfg) }

Error is: Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/local_security_policy: undefined method `path' for nil:NilClass at /etc/puppetlabs/code/environments/rolecijagts/site/profile/manifests/local_security.pp:30:5 on node

Randy2009 commented 7 years ago

Hello,

For some reason, it just works again. We did a change in you're module, it fixed it. We undo the changes and the problem didn't happen again.

The file base/manifests/mssql.pp:16:5 is the call to local_security_policy:

local_security_policy { 'Lock pages in memory':
  ensure            => present,
  policy_value      => "$sqlserviceaccount",
  policy_value      => $sqlserviceaccount
}
lmayorga1980 commented 7 years ago

@Randy2009 can you share that change?

ayohrling commented 7 years ago

If you push a PR I'll review it. My biggest problem is a lack of a test bed for these changes that encompasses all of the server editions

Sent from my iPhone

On Nov 8, 2016, at 11:39, Luis Mayorga notifications@github.com wrote:

@Randy2009 can you share that change?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

lmayorga1980 commented 7 years ago

I am using Windows 2008R2 and not sure if the implementation is different on Windows 2012R2. Will dig deeper...

ripclawffb commented 7 years ago

So after some additional troubleshooting, it looks like this module doesn't work with environments. If I install this module locally on the server and create a manifest file, everything works properly. If the module is defined in the production Puppetfile, everything works properly as well. I only have issues when the module is defined ONLY in the puppet environment I'm working on and it doesn't exist in the production Puppetfile.

jrwesolo commented 7 years ago

I'm experiencing this same issue. Windows Server 2012R2 with Puppet version 4.8.1. I am using environments.

jrwesolo commented 7 years ago

I opened #24 to fix this issue. It will fallback to a previous technique for loading the files. It works for me on 2012R2.

jrwesolo commented 7 years ago

@ripclawffb If you use r10k you can try using the following in your Puppetfile:

mod 'ayohrling/local_security_policy',
  git: 'https://github.com/jrwesolo/local_security_policy',
  commit: '3ea5d3bcd44e631eaaf5ba0c2307373e4a342606'

This is the same code that #24 is looking to get merged in.

ayohrling commented 7 years ago

0.6.1 cut and pushed to forge

On Mon, Jan 2, 2017 at 3:35 PM, Jordan Wesolowski notifications@github.com wrote:

@ripclawffb https://github.com/ripclawffb If you use r10k you can try using the following in your Puppetfile:

mod 'ayohrling/local_security_policy', git: 'https://github.com/jrwesolo/local_security_policy', commit: '3ea5d3bcd44e631eaaf5ba0c2307373e4a342606'

This is the same code that #24 https://github.com/ayohrling/local_security_policy/pull/24 is looking to get merged in.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ayohrling/local_security_policy/issues/21#issuecomment-270017620, or mute the thread https://github.com/notifications/unsubscribe-auth/AFA67DoLpHOcoHB0ThGkUXMjNzfvk1Fsks5rOV-ogaJpZM4KP6R_ .

-- Adam R. Yohrling