Last active
December 8, 2015 14:36
-
-
Save hkraji/a29b4241194cb7c3b9bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'puppet' | |
puppet_params = { | |
:name => 'foo', | |
:ensure => 'present', | |
:key => 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDH1chpGVgtqgdXh62qS1V2g8Ic2nbpfXgzXAseObYYocOa0NIeCOmFxbMEhzT9h6/EhYTpF6tq0Gn8aBBd8gb90OlHdTIZ2j9IVhqLxmwnUJ3lwTbq6cEdVy1M/TM+A/TygRcqRrbNgoswGaVem | |
lfk7caeenN2KxG3vjzq5cCIAhGD7DeI9qQawZuKdJOCOgqUL6rF/J9nyyzPAS5uCeQumncGR+cfrywe9ZCUJrUbrWeYFHtB0d3XhbxCYJIqui3kMmbhQzsLGka9tcWQ1Zwm7VpcIrgerEyHO+0aNusG1szvxQkVWk1Bi7RI8fNLaogSq+HqkU2CRH | |
nEk7arJa9t', | |
:type => 'ssh-rsa', | |
:user => 'ubuntu' | |
} | |
puppet_definition = :ssh_authorized_key | |
if Puppet.settings.respond_to?(:initialize_global_settings) | |
Puppet.settings.initialize_global_settings | |
end | |
if Puppet.settings.respond_to?(:initialize_app_defaults) | |
Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(Puppet.run_mode)) | |
end | |
pup = Puppet::Type.type(puppet_definition).new(puppet_params) | |
catalog = Puppet::Resource::Catalog.new | |
catalog.add_resource pup | |
catalog.apply() | |
=begin | |
ruby puppet_point_of_failure.rb | |
/opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/context.rb:54:in `lookup': Could not autoload puppet/type/ssh_authorized_key: no 'environments' in {:current_environment=>*root*, :root_environment=>*root*} at top of [[0, nil, nil]] (Puppet::Error) | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet.rb:226:in `lookup' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:131:in `module_directories' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:160:in `search_directories' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:94:in `files_to_load' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:75:in `loadall' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:209:in `loadall' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/metatype/manager.rb:122:in `newtype' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet.rb:163:in `newtype' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/type/ssh_authorized_key.rb:2:in `<module:Puppet>' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/type/ssh_authorized_key.rb:1:in `<top (required)>' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:62:in `load' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:62:in `load_file' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/util/autoload.rb:195:in `load' | |
from /opt/puppet-omnibus/embedded/lib/ruby/gems/1.9.1/gems/puppet-3.6.2/lib/puppet/metatype/manager.rb:163:in `type' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment