Puppet -> undefined method 'to_sym' for []:Array - ruby

this is my 10th day using puppet so sorry if there is not enough information.
I installed module 'statsd' from: https://forge.puppet.com/jdowning/statsd on my puppet-master and used it like in readme file.
class { 'statsd':
backends => ['./backends/graphite'],
graphiteHost => "graphite-relay.dev.sizmdx.com",
graphite_globalPrefix => 'statsite',
graphite_legacyNamespace => false,
stackdriver_sendTimerPercentiles => false,
configfile => '/etc/statsd/localConfig.js'
}
I keep getting this error:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Error from DataBinding 'hiera' while looking up 'statsd::librato_skipInternalMetrics': undefined method `to_sym' for []:Array on node beadmin-dev0-lior-cm-3f4gxw0f.sizmek
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
We do have 'Heira' in the puppet project (altough I'm not familiar too much with that)
here the Heira.yaml:
:backends:
- yaml
:hierarchy:
- client/%{clientcert}
- roles/%{role}
- environment/%{env}
- global
:yaml:
:datadir: /opt/puppet/hiera
I google'd the error without any findings, any suggestions ?
if need more information please let me know.
thanks in advance

Related

Chef - Ruby - ArgumentsError expected 0

I'm trying to write a cookbook in Chef (very new) and I get the following error I cannot wrap my head around.
template node '/etc/selinux/config' do
source "config.erb"
mode "0644"
variables(
:selinux_state => node['selinux']['selinux-state'],
:selinux_type => node['selinux']['selinux-type']
)
owner duser
group dgroup
action :create
ignore_failure true
end
FATAL: ArgumentError: wrong number of arguments (given 1, expected 0)
I checked the documentation and as far as I can tell I am following the correct syntax.
Could anyone please enlighten me where the error is?
You have an extra node in the resource declaration. Change:
template node '/etc/selinux/config' do
to
template '/etc/selinux/config' do

Getting error Aws::S3::Errors::InvalidBucketName when creating bucket

I am trying to create a bucket, with help of aws-sdk-ruby from ruby console. Following is the code I am running in my console:
Aws.config.update({
:region => "myRegion",
:credentials => Aws::Credentials.new("access_key", "secret_key"),
:endpoint => "http://Ip",
:force_path_style => true
})
bucket_name = "abc"
bucket = s3.bucket(bucket_name)
bucket.create({ acl: "authenticated-read", grant_full_control: "GrantFullControl"})
Last line gives this error:
Aws::S3::Errors::InvalidBucketName:
I dont see this error in the documentation here. When can one get such error and how to resolve this?
I was also getting this error.. the main reason why was getting this error because my bucket name was starting with capital letter.. Bucket name always starts with lowercase ..

Error while running elasticsearch using puppet

My puppet config is:
class { 'elasticsearch':
java_install => true,
manage_repo => true,
repo_version => '2.x',
version => "2.4.4",
}
elasticsearch::instance { 'es-01': }
After running puppet agent got this error:
Error: Failed to apply catalog: Section "base" is already defined, cannot redefine in /etc/yum.repos.d/centos.repo
Elasticsearch is running on centos-7
This is caused by puppet pre-fetching the yum repos.
If there are more than one repository with the same label you will see your already defined error when puppet is set to use Yumrepo. The error will show the first duplicate alphabetically and abort.
You can reproduce the error following these steps: duplicate a .repo, apply manifest with yumrepo
Initial Repo:
puppet apply -e "yumrepo { 'test': ensure => 'present', baseurl => 'http://test/repourl', descr => 'test' }"
Then duplicate the repo so you have two [test] repos:
cp -p /etc/yum.repos.d/test.repo /etc/yum.repos.d/test2.repo
Now any attempt to use puppet with Yumrepo fails, reproduced below:
# puppet apply -e "yumrepo { 'someapp': ensure => 'present', baseurl => 'http://test/repourl', descr => 'some app' }"
...which yields the following error:
Error: Failed to apply catalog: Section "test" is already defined, cannot redefine in /etc/yum.repos.d/test2.repo
For your error, see which files are duplicating [base]:
grep '^\[base]$' /etc/yum.repos.d/*.repo

Parse.com CloudCode beforeSave trigger errors

Context: parse.com CloudCode, executing beforeSave() trigger on data object object update.
Getting a rash of unexplained errors in simple trigger function (code below). The errors are mostly
Result: Uncaught undefined
but there are also several
Result: Execution timed out
The code is simple, I have checked it to the point where I don't think this is an error due to the code, but including it anyway since I know people will ask to see it.
This seems (seems!) to be an issue in Parse itself, which I've been unable to solve.
Parse.Cloud.beforeSave("LogoItem", function(request, response) {
var name = request.object.get("productName");
if (typeof name == "undefined") {
name = "";
}
request.object.set("lowercaseName", name.toLowerCase());
response.success(); // Tells parse not to cancel save
});
My question is, has anyone seen this and been able to get any handle on a solution?
Below is some additional detail (logs from parse) that likely won't be too useful (but never know)...
E2016-03-14T14:12:26.306Z] - v643 Ran job ShopSenseJob with:
Input: {"plan":"paid"}
Result: ERROR: startDownloadItems() failed with error [undefined: undefined] undefined: undefined
E2016-03-14T14:11:01.536Z] - v643 before_save triggered for LogoItem as master:
Input: {"original":{"activeURL":"http://api.shopstyle.com/action/apiVisitRetailer?id=486671765\u0026pid=uid4009-26060253-59","category":5,"createdAt":"2016-03-14T13:41:07.487Z","imageURL":"https://resources.shopstyle.com/pim/aa/92/aa9286b799d7640f276657fa5e41ee92_best.jpg","importMarkerTag":6624,"lowercaseName":"mid rise skinny with knee holes in marie vintage blue","objectId":"8o9e8nMF7m","productName":"Mid Rise Skinny With Knee Holes In Marie Vintage Blue","referenceURL":"http://www.shopstyle.com/p/7-for-all-mankind-mid-rise-skinny-with-knee-holes-in-marie-vintage-blue/486671765?pid=uid4009-26060253-59","ssBrandId":3,"ssBrandName":"7 For All Mankind","ssDate":{"__type":"Date","iso":"2014-12-05T00:00:00.000Z"},"ssId":486671765,"ssRetailerId":193,"thumbnailURL":"https://resources.shopstyle.com/pim/aa/92/aa9286b799d7640f276657fa5e41ee92_best.jpg","updatedAt":"2016-03-14T13:41:07.487Z"},"update":{"importMarkerTag":1556}}
Result: Execution timed out
E2016-03-14T14:10:21.498Z] - v643 Ran job ShopSenseJob with:
Input: {}
Result: ERROR: startDownloadItems() failed with error [undefined: undefined] undefined: undefined
E2016-03-14T14:08:18.638Z] - v643 before_save triggered for LogoItem as master:
Input: {"original":{"activeURL":"http://api.shopstyle.com/action/apiVisitRetailer?id=490062821\u0026pid=uid4009-26060253-59","category":2,"createdAt":"2016-03-14T13:40:12.971Z","imageURL":"https://resources.shopstyle.com/pim/20/cb/20cb7387834dd02ac9d950bde0f57b83_best.jpg","importMarkerTag":1556,"lowercaseName":"baggu basic tote in brown","objectId":"I4UTiUMnUG","productName":"Baggu Basic Tote In Brown","referenceURL":"http://www.shopstyle.com/p/baggu-basic-tote-in-brown/490062821?pid=uid4009-26060253-59","ssBrandId":-1,"ssBrandName":"","ssDate":{"__type":"Date","iso":"2014-12-03T00:00:00.000Z"},"ssId":490062821,"ssRetailerId":193,"thumbnailURL":"https://resources.shopstyle.com/pim/20/cb/20cb7387834dd02ac9d950bde0f57b83_best.jpg","updatedAt":"2016-03-14T14:06:12.708Z"},"update":{"importMarkerTag":1556}}
Result: Uncaught undefined
E2016-03-14T14:08:18.225Z] - v643 Ran job ShopSenseJob with:
Input: {}
Result: ERROR: startDownloadItems() failed with error [undefined: undefined] undefined: undefined
E2016-03-14T14:06:12.824Z] - v643 before_save triggered for LogoItem as master:
Input: {"original":{"activeURL":"http://api.shopstyle.com/action/apiVisitRetailer?id=489915836\u0026pid=uid4009-26060253-59","category":2,"createdAt":"2016-03-14T13:40:13.193Z","imageURL":"https://resources.shopstyle.com/pim/14/ef/14ef17ff769227c4293892e770fcf50a_best.jpg","importMarkerTag":1556,"lowercaseName":"basic tote in black","objectId":"JQ7GuRjfgH","productName":"Basic Tote In Black","referenceURL":"http://www.shopstyle.com/p/baggu-basic-tote-in-black/489915836?pid=uid4009-26060253-59","ssBrandId":25820,"ssBrandName":"Baggu","ssDate":{"__type":"Date","iso":"2014-12-02T00:00:00.000Z"},"ssId":489915836,"ssRetailerId":193,"thumbnailURL":"https://resources.shopstyle.com/pim/14/ef/14ef17ff769227c4293892e770fcf50a_best.jpg","updatedAt":"2016-03-14T14:06:10.013Z"},"update":{"importMarkerTag":1556}}
Result: Execution timed out
E2016-03-14T14:05:23.844Z] - v643 Ran job ShopSenseJob with:
Input: {}
Result: ERROR: startDownloadItems() failed with error [undefined: undefined] undefined: undefined

Shibboleth authentication in Rails

I am having a struggle getting this to work so I've created a hell-world Rails app to try and get this to work.
Here's the repo with the code that is not working: https://github.com/pitosalas/shibtry
Here's what I've done starting from an empty Rails application:
I've added two gems to gem files:
gem 'omniauth-shibboleth'
gem 'rack-saml'
I got the shibboleth meta data from my university's web site and converted it using shib_conv.rb into the corresponding YAML: ./config.yml
I've updated routes adding get '/auth/:provider/callback', to: 'sessions#create'
I've put a breakpoint at SessionController#create
I've added initializers: omniauth.rb:
Rails.application.config.middleware.use OmniAuth::Builder do
provider :shibboleth, {
:shib_session_id_field => "Shib-Session-ID",
:shib_application_id_field => "Shib-Application-ID",
:debug => true,
:extra_fields => [
:"unscoped-affiliation",
:entitlement
]
}
end
I've added rack_sam.rb initializer:
Rails.application.config.middleware.insert_after Rack::ETag, Rack::Saml,
{ :metadata => "#{Rails.root}/config/metadata.yml"}
Now, run the server and go to http://0.0.0.0:3000/auth/shibboleth and I get an error:
undefined method `[]' for nil:NilClass'
which is traced back to this line in rack-saml/misc/onelogin_setting.rb line 13 which is:
settings.idp_sso_target_url = #metadata['saml2_http_redirect']
in other words, looking for the metadata hash for that key. It happens that in my metadata.yml file that key is present, but by the time I get to this onelogin_setting.rb line 13, #metadata is nil (it should contain the contents of the file) and consequently that key doesn't exist.
And that's where, for now, the trail dries up.
I bypassed Shibboleth totally. My goal was to allow login to my universities authentication system specifically to allow students to log in with their student login, which is fronted by google apps. So this was much easier: https://developers.google.com/identity/sign-in/web/
Looks like you forgot to add your config file to the initializer:
Rails.application.config.middleware.insert_after Rack::ETag, Rack::Saml,
{
:metadata => "#{Rails.root}/config/metadata.yml",
:config => "#{Rails.root}/config/rack-saml.yml"
}
And the saml_idp setting in the rack-saml.yml must match the key for the idp_lists entry in your metadata.yml

Resources