I have installed craft CMS 3 via composer, running on MAMP (windows 10) and successfully created a few templates and entries.
However, When I try to access the plugin store I see the following error on the page: "The Plugin Store is not available, please try again later."
and in the console I see the two internal server errors copied below:
I was able to install the contact form plugin via composer. but not for other plugins (e.g. sprout forms)
I am also seeing an 'unknown error' message at the dashboard: jquery.js:9566 POST http://localhost:81/index.php?p=admin/actions/dashboard/get-feed-items 500 (Internal Server Error)
Has anyone else seen this issue?
Console error messages when trying to access the plugin store:
axios.js:853 GET http://localhost:81/index.php?p=admin/actions/plugin-store/plugin-store-data 500 (Internal Server Error)
(anonymous) # axios.js:853
e.exports # axios.js:687
e.exports # axios.js:1367
Promise.then (async)
a.request # axios.js:525
a.(anonymous function) # axios.js:535
(anonymous) # axios.js:439
Q # main.js:1
(anonymous) # main.js:1
getPluginStoreData # main.js:1
(anonymous) # vuex.js:710
l.dispatch # vuex.js:432
dispatch # vuex.js:338
created # main.js:1
yt # vue.min.js:6
pn._init # vue.min.js:6
pn # vue.min.js:6
(anonymous) # main.js:1
l # jquery.js:3583
c # jquery.js:3651
setTimeout (async)
(anonymous) # jquery.js:3689
c # jquery.js:3317
fireWith # jquery.js:3447
fire # jquery.js:3455
c # jquery.js:3317
fireWith # jquery.js:3447
ready # jquery.js:3920
B # jquery.js:3930
axios.js:853
GET http://localhost:81/index.php?p=admin/actions/plugin-store/craft-data 500 (Internal Server Error)
(anonymous) # axios.js:853
e.exports # axios.js:687
e.exports # axios.js:1367
Promise.then (async)
a.request # axios.js:525
a.(anonymous function) # axios.js:535
(anonymous) # axios.js:439
W # main.js:1
(anonymous) # main.js:1
getCraftData # main.js:1
(anonymous) # vuex.js:710
l.dispatch # vuex.js:432
dispatch # vuex.js:338
created # main.js:1
yt # vue.min.js:6
pn._init # vue.min.js:6
pn # vue.min.js:6
(anonymous) # main.js:1
l # jquery.js:3583
c # jquery.js:3651
setTimeout (async)
(anonymous) # jquery.js:3689
c # jquery.js:3317
fireWith # jquery.js:3447
fire # jquery.js:3455
c # jquery.js:3317
fireWith # jquery.js:3447
ready # jquery.js:3920
B # jquery.js:3930
this was a curl 60 error. To fix it, I downloaded cacert.pem from curl.haxx.se/ca/cacert.pem and saved it into the same folder that I have my mamp php version. Then referenced this in php.ini like so:
[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an
; absolute path.
curl.cainfo ="{{ path to cacert.pem"}}
Related
I am building a static tab for MS Teams with contentBotId specified.The staticTabs manifest entry looks as following:
"staticTabs": [
{
"entityId": "availability",
"name": "Availability",
"scopes": [ "personal" ],
"contentBotId": "myBotId",
"context": [ "personalTab" ]
},
{
"entityId": "coffees",
"name": "Coffees",
"scopes": [ "personal" ],
"contentUrl": "https://my-content-url.com/...",
"websiteUrl": "https://my-website-url.com/...",
"context": ["personalTab"]
}
],
So, the Availability tab is using contentBotId and Coffees tab is a website. I have no problems with Coffees tab at all but have problems with Availability tab in chat scope. when I am trying to open the Availability tab from personal apps side panel - all works as expected:
But when I am trying to open the same tab from chat with my bot - MS Teams shows There was a problem reaching this app error:
In MS Team Dev console I can see the following errors:
CDL: {"errorCode":"Error","requestId":"q-15","hostRendererId":"5e3ce6c0-2b1f-4285-8d4b-75ee78787346","component":"RequestHandler","requestWindowId":"main","operationType":"query","operationName":"appDefinition","message":"error while processing q-15: {\"name\":\"Error\",\"message\":\"Variable \\\"$appId\\\" got invalid value undefined; Expected non-nullable type \\\"ID!\\\" not to be null.\",\"stack\":[]} (reason: undefined)"}
console.error # ?agent=electron&version=21071502213:1
invoke # main-2d2eb2cbb891032b.js:22
error # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:22
safeWrapILoggerCall # main-2d2eb2cbb891032b.js:22
error # main-2d2eb2cbb891032b.js:22
onError # main-2d2eb2cbb891032b.js:22
setResponseAndEndScenario # main-2d2eb2cbb891032b.js:22
reconcileResponse # main-2d2eb2cbb891032b.js:22
onMessageReceived # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:27
(anonymous) # main-2d2eb2cbb891032b.js:27
(anonymous) # VM5:2
emit # electron/js2c/sandbox_bundle.js:170
onMessage # electron/js2c/sandbox_bundle.js:151
TrackRequestLink: 'appDefinition' operation of type 'query' failed.
console.error # ?agent=electron&version=21071502213:1
invoke # main-2d2eb2cbb891032b.js:22
error # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:22
Ds # main-2d2eb2cbb891032b.js:22
Ms # main-2d2eb2cbb891032b.js:22
error # main-2d2eb2cbb891032b.js:22
m # 73296-3f79f77061841a23.js:1
b # 73296-3f79f77061841a23.js:1
value # 73296-3f79f77061841a23.js:1
error # 73296-3f79f77061841a23.js:1
m # 73296-3f79f77061841a23.js:1
b # 73296-3f79f77061841a23.js:1
value # 73296-3f79f77061841a23.js:1
(anonymous) # main-2d2eb2cbb891032b.js:22
onError # main-2d2eb2cbb891032b.js:22
onError # main-2d2eb2cbb891032b.js:22
setResponseAndEndScenario # main-2d2eb2cbb891032b.js:22
reconcileResponse # main-2d2eb2cbb891032b.js:22
onMessageReceived # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:22
(anonymous) # main-2d2eb2cbb891032b.js:27
(anonymous) # main-2d2eb2cbb891032b.js:27
(anonymous) # VM5:2
emit # electron/js2c/sandbox_bundle.js:170
onMessage # electron/js2c/sandbox_bundle.js:151
TrackRequestLink: Errors ['{"name":"Error","message":"Variable \"$appId\" got invalid value undefined; Expected non-nullable type \"ID!\" not to be null.","stack":[]}']
Error: Unable to fetch app definition
I've double checked manifest schema and think I am not missing anything but might be wrong. Please correct me if so. The schema I am using is: https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json and manifest version is 1.9
Let me know if you need more details from me and thank you for help!
I've not ever tried using contentBotId as I've always had web content behind my tab, but as a backup you can consider creating a web page / SPA that simply hosts and renders your adaptive card using the javascript library. Here's an example: https://learn.microsoft.com/en-us/adaptive-cards/sdk/rendering-cards/javascript/render-a-card
This bug fix is on the way. We do not have exact ETA to share but it will be available publicly soon.
I'm working to create a Logstash Input plugin to utilize ADAL for integration with the Office 365 Management Activity API's. I've written the individual components to get a token, use that token to subscribe, and to pull activity log data.
Now I'm working to integrate into the Logstash framework, and running into issues where Logstash is complaining that it's doesn't know what ADAL is, even though I have it required.
All the same code works independently outside of Logstash, just not within the plugin class.
This is my first foray into Ruby, so I'm pretty stumped. Any help?
Error message from Logstash:
[2018-09-16T00:51:32,816][INFO ][logstash.pipeline ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2018-09-16T00:51:33,921][INFO ][logstash.inputs.office365managementapi] Starting Office 365 Management API input...
[2018-09-16T00:51:34,246][ERROR][logstash.pipeline ] Error registering plugin {:pipeline_id=>"main", :plugin=>"<LogStash::Inputs::Office365ManagementApi client_id=>\"redacted\", tenant_id=>\"redacted\", tenant_domain=>\"redacted\", private_key=>\"/tmp/o365.pfx\", subscriptions=>[\"Audit.AzureActiveDirectory\", \"Audit.Exchange\", \"Audit.SharePoint\", \"Audit.General\", \"DLP.All\"], id=>\"fb61b83b76494f098a0a7e24391779ee1212f0d9adf8ef8dedae4424e8dedb57\", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>\"plain_c7c9d514-5d23-459d-98ea-87d250e7a00c\", enable_metric=>true, charset=>\"UTF-8\">, resource=>\"https://manage.office.com\">", :error=>"uninitialized constant LogStash::Inputs::Office365ManagementApi::ADAL::Logging\nDid you mean? LogStash::Logging", :thread=>"#<Thread:0xca2e135 run>"}
[2018-09-16T00:51:34,367][ERROR][logstash.pipeline ] Pipeline aborted due to error {:pipeline_id=>"main", :exception=>#<NameError: uninitialized constant LogStash::Inputs::Office365ManagementApi::ADAL::Logging
Did you mean? LogStash::Logging>, :backtrace=>["org/jruby/RubyModule.java:3343:in `const_missing'", "/usr/local/Cellar/logstash/6.2.4/libexec/vendor/local_gems/82bdbf8d/logstash-input-office365_management_api-1.0.0/lib/logstash/inputs/office365_management_api.rb:70:in `register'", "/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:342:in `register_plugin'", "/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:353:in `block in register_plugins'", "org/jruby/RubyArray.java:1734:in `each'", "/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:353:in `register_plugins'", "/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:500:in `start_inputs'", "/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:394:in `start_workers'", "/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:290:in `run'", "/usr/local/Cellar/logstash/6.2.4/libexec/logstash-core/lib/logstash/pipeline.rb:250:in `block in start'"], :thread=>"#<Thread:0xca2e135 run>"}
[2018-09-16T00:51:34,418][ERROR][logstash.agent ] Failed to execute action {:id=>:main, :action_type=>LogStash::ConvergeResult::FailedAction, :message=>"Could not execute action: LogStash::PipelineAction::Create/pipeline_id:main, action_result: false", :backtrace=>nil}
Code is below:
# encoding: utf-8
require "logstash/inputs/base"
require "logstash/namespace"
require "stud/interval"
require "socket" # for Socket.gethostname
require "json"
require 'net/http'
require 'uri'
# Using this input you can receive activities from the Office 365 Management API
# ==== Security
# This plugin utilizes certificate authentication with the Office 365 Management API
# to generate an access token, which is then used for all subsequent API activities.
# If the token expires, the plugin will request a new token automatically.
# All communication for this plugin is encrypted by SSL/TLS communication.
class LogStash::Inputs::Office365ManagementApi < LogStash::Inputs::Base
config_name "office365_management_api"
# Codec used to decode the incoming data.
# This codec will be used as a fall-back if the content-type
# is not found in the "additional_codecs" hash
default :codec, "plain"
# Fix for broken ruby ADAL
module ADAL
class TokenRequest
module GrantType
JWT_BEARER = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
end
end
end
# Client ID generated through your custom application in Azure AD
# https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredApps
config :client_id, :validate => :string, :required => true
# Tenant ID/Directory ID of your Office 365 tenant
# https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/Properties
config :tenant_id, :validate => :string, :required => true
# Your Office 365 tenant domain, ie. yourdomain.onmicrosoft.com
config :tenant_domain, :validate => :string, :required => true
# Resource you are requesting access to. This defaults to https://manage.office.com and shouldn't change unless necessary.
config :resource, :validate => :string, :default => 'https://manage.office.com'
# PFX Private key for your Application Certificate you created
config :private_key, :validate => :path
# Private key password if one was used
config :private_key_password, :validate => :string, :default => nil
# Activity subscriptions you want to monitor
# These can be one or many of:
# Audit.AzureActiveDirectory
# Audit.Exchange
# Audit.Sharepoint
# Audit.General
# DLP.All
config :subscriptions, :validate => :array, :default => ["Audit.AzureActiveDirectory", "Audit.Exchange", "Audit.SharePoint", "Audit.General", "DLP.All"]
public
def register
require "adal"
#logger.info("Starting Office 365 Management API input...")
#host = Socket.gethostname
# ADAL supports four logging options: VERBOSE, INFO, WARN and ERROR.
ADAL::Logging.log_level = ADAL::Logger::VERBOSE
end # def register
def get_token
#logger.info("Generating access token...")
if #private_key_password.nil?
pfx = OpenSSL::PKCS12.new(File.read(#private_key))
else
pfx = OpenSSL::PKCS12.new(File.read(#private_key), #private_key_password)
end
authority = ADAL::Authority.new("login.microsoftonline.com", #tenant_domain)
client_cred = ADAL::ClientAssertionCertificate.new(authority, #client_id, pfx)
result = ADAL::AuthenticationContext
.new("login.microsoftonline.com", #tenant_domain)
.acquire_token_for_client(#resource, client_cred)
case result
when ADAL::SuccessResponse
puts 'Successfully authenticated with client credentials. Received access ' "token: #{result.access_token}."
# Create class variable for reuse of Access Token
#access_token = result.access_token
#http_headers = {
'Authorization' => "Bearer #{#access_token}",
'Content-Type' => 'application/x-www-form-urlencoded'
}
when ADAL::FailureResponse
puts 'Failed to authenticate with client credentials. Received error: ' "#{result.error} and error description: #{result.error_description}."
exit 1
end
end #def get_token
def check_subscription
#logger.info("Checking for proper subscriptions...")
#subscriptions.each do |sub|
sub_uri = URI("https://manage.office.com/api/v1.0/#{#tenant_id}/activity/feed/subscriptions/start?contentType=#{sub}")
sub_http = Net::HTTP.new(sub_uri.host, sub_uri.port)
sub_http.use_ssl = true
sub_resp = http.post(sub_uri.request_uri, data = "", #http_headers)
case sub_resp
when Net::HTTPSuccess
puts "Created subscription to #{sub} in tenant #{#tenant_id}..."
when Net::HTTPUnauthorized
puts "Authentication Error Encountered: #{sub_resp.message}"
when Net::HTTPServerError
puts "Server Error Encountered: #{sub_resp.message}"
else
puts "Unknown Error Encountered: #{sub_resp.message}"
end
end
end #def check_subscription
def run(queue)
# we can abort the loop if stop? becomes true
while !stop?
#event = LogStash::Event.new("message" => #message, "host" => #host)
#decorate(event)
#queue << event
raise 'Error getting token' unless get_token().status == 0
# because the sleep interval can be big, when shutdown happens
# we want to be able to abort the sleep
# Stud.stoppable_sleep will frequently evaluate the given block
# and abort the sleep(#interval) if the return value is true
Stud.stoppable_sleep(#interval) { stop? }
end # loop
end # def run
def stop
# nothing to do in this case so it is not necessary to define stop
# examples of common "stop" tasks:
# * close sockets (unblocking blocking reads/accepts)
# * cleanup temporary files
# * terminate spawned threads
end
end # class LogStash::Inputs::Office365ManagementApi
There appears to be a bug when using empty passwords with logstash.
The code responsible for this comes from the calculate_property method in HttpClient , that treats empty strings as nil:
default = nil if default.is_a?(String) && default.empty? # Blanks are as good as nil
uri_value = nil if uri_value.is_a?(String) && uri_value.empty?
One way to fix this is by upgrading to the latest Logstash, if you are currently using an older version.
I'm using CKEditor 4.5.6 for an WebsiteBuilder and I added this Glyphicons plugin:
Glyphicon CKEditor Plugin
My problem is that when I want to move the icon, it disappears and got an error:
Uncaught TypeError: el.find is not a function
at getFirstTextNode (plugin.js?t=FB9E:2150)
at preserveSpaces (plugin.js?t=FB9E:2121)
at Repository.wrapElement (plugin.js?t=FB9E:699)
at a.<anonymous> (plugin.js?t=FB9E:2920)
at a.q (ckeditor.js:10)
at a.<anonymous> (ckeditor.js:12)
at a.CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js:13)
at CKEDITOR.htmlDataProcessor.toHtml (ckeditor.js:300)
at ckeditor.js:373
at b.insertHtml (ckeditor.js:341)
getFirstTextNode # plugin.js?t=FB9E:2150
preserveSpaces # plugin.js?t=FB9E:2121
wrapElement # plugin.js?t=FB9E:699
(anonymous) # plugin.js?t=FB9E:2920
q # ckeditor.js:10
(anonymous) # ckeditor.js:12
CKEDITOR.editor.CKEDITOR.editor.fire # ckeditor.js:13
toHtml # ckeditor.js:300
(anonymous) # ckeditor.js:373
insertHtml # ckeditor.js:341
(anonymous) # ckeditor.js:351
q # ckeditor.js:10
(anonymous) # ckeditor.js:12
CKEDITOR.editor.CKEDITOR.editor.fire # ckeditor.js:13
insertHtml # ckeditor.js:254
(anonymous) # ckeditor.js:653
q # ckeditor.js:10
(anonymous) # ckeditor.js:12
CKEDITOR.editor.CKEDITOR.editor.fire # ckeditor.js:13
r # ckeditor.js:626
internalDrop # ckeditor.js:657
(anonymous) # ckeditor.js:647
setTimeout (async)
(anonymous) # ckeditor.js:647
q # ckeditor.js:10
(anonymous) # ckeditor.js:12
CKEDITOR.editor.CKEDITOR.editor.fire # ckeditor.js:13
e # ckeditor.js:644
(anonymous) # ckeditor.js:647
q # ckeditor.js:10
(anonymous) # ckeditor.js:12
(anonymous) # ckeditor.js:52
Did someone meet this problem. Can it be resolved in an wasy way? I'm using CKEditor for the first time, so I don't have big experiences with it.
P.S.: I've already used the plugin discussion to ask for help.
There was a big refactor of the widget plugin, which broke a few plugins depending on this one (eg. placeholder, token)
This is the share of the commit
https://github.com/ckeditor/ckeditor-dev/commit/2fca8e6248aebab164133e9cd97403cb2de9a006
So you will need to reach out to the maintainer of the widget
If the plugin is not updated, you will need to use old version of widget.
I'm trying to run a puppet apply and thrown with bunch of errors.
hiera -c /etc/puppet/hiera.yaml classes
generates the following :
/usr/share/ruby/vendor_ruby/2.0/psych.rb:205:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 238 column 3 (Psych::SyntaxError)
from /usr/share/ruby/vendor_ruby/2.0/psych.rb:205:in `parse_stream'
from /usr/share/ruby/vendor_ruby/2.0/psych.rb:153:in `parse'
from /usr/share/ruby/vendor_ruby/2.0/psych.rb:129:in `load'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend/yaml_backend.rb:18:in `block (2 levels) in lookup'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/filecache.rb:53:in `read_file'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend/yaml_backend.rb:17:in `block in lookup'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:104:in `block in datasourcefiles'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:76:in `block in datasources'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:74:in `map'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:74:in `datasources'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:99:in `datasourcefiles'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend/yaml_backend.rb:16:in `lookup'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:206:in `block in lookup'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:203:in `each'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera/backend.rb:203:in `lookup'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/lib/hiera.rb:60:in `lookup'
from /usr/local/share/ruby/gems/2.0/gems/hiera-1.3.4/bin/hiera:225:in `<top (required)>'
from /usr/local/bin/hiera:23:in `load'
from /usr/local/bin/hiera:23:in `<main>'
contents of the file:
require 'psych.so'
require 'psych/nodes'
require 'psych/streaming'
require 'psych/visitors'
require 'psych/handler'
require 'psych/tree_builder'
require 'psych/parser'
require 'psych/omap'
require 'psych/set'
require 'psych/coder'
require 'psych/core_ext'
require 'psych/deprecated'
require 'psych/stream'
require 'psych/json/tree_builder'
require 'psych/json/stream'
require 'psych/handlers/document_stream'
###
# = Overview
#
# Psych is a YAML parser and emitter.
# Psych leverages libyaml [Home page: http://pyyaml.org/wiki/LibYAML]
# or [Git repo: https://github.com/zerotao/libyaml] for its YAML parsing
# and emitting capabilities. In addition to wrapping libyaml, Psych also
# knows how to serialize and de-serialize most Ruby objects to and from
# the YAML format.
#
# = I NEED TO PARSE OR EMIT YAML RIGHT NOW!
#
# # Parse some YAML
# Psych.load("--- foo") # => "foo"
#
# # Emit some YAML
# Psych.dump("foo") # => "--- foo\n...\n"
# { :a => 'b'}.to_yaml # => "---\n:a: b\n"
#
# Got more time on your hands? Keep on reading!
#
# == YAML Parsing
#
# Psych provides a range of interfaces for parsing a YAML document ranging from
# low level to high level, depending on your parsing needs. At the lowest
# level, is an event based parser. Mid level is access to the raw YAML AST,
# and at the highest level is the ability to unmarshal YAML to ruby objects.
#
# === Low level parsing
#
# The lowest level parser should be used when the YAML input is already known,
# and the developer does not want to pay the price of building an AST or
# automatic detection and conversion to ruby objects. See Psych::Parser for
# more information on using the event based parser.
#
# === Mid level parsing
#
# Psych provides access to an AST produced from parsing a YAML document. This
# tree is built using the Psych::Parser and Psych::TreeBuilder. The AST can
# be examined and manipulated freely. Please see Psych::parse_stream,
# Psych::Nodes, and Psych::Nodes::Node for more information on dealing with
# YAML syntax trees.
#
# === High level parsing
#
# The high level YAML parser provided by Psych simply takes YAML as input and
# returns a Ruby data structure. For information on using the high level parser
# see Psych.load
#
# == YAML Emitting
#
# Psych provides a range of interfaces ranging from low to high level for
# producing YAML documents. Very similar to the YAML parsing interfaces, Psych
# provides at the lowest level, an event based system, mid-level is building
# a YAML AST, and the highest level is converting a Ruby object straight to
# a YAML document.
#
# === Low level emitting
#
# The lowest level emitter is an event based system. Events are sent to a
# Psych::Emitter object. That object knows how to convert the events to a YAML
# document. This interface should be used when document format is known in
# advance or speed is a concern. See Psych::Emitter for more information.
#
# === Mid level emitting
#
# At the mid level is building an AST. This AST is exactly the same as the AST
# used when parsing a YAML document. Users can build an AST by hand and the
# AST knows how to emit itself as a YAML document. See Psych::Nodes,
# Psych::Nodes::Node, and Psych::TreeBuilder for more information on building
# a YAML AST.
#
# === High level emitting
#
# The high level emitter has the easiest interface. Psych simply takes a Ruby
# data structure and converts it to a YAML document. See Psych.dump for more
# information on dumping a Ruby data structure.
module Psych
# The version is Psych you're using
VERSION = '2.0.0'
# The version of libyaml Psych is using
LIBYAML_VERSION = Psych.libyaml_version.join '.'
class Exception < RuntimeError
end
class BadAlias < Exception
end
###
# Load +yaml+ in to a Ruby data structure. If multiple documents are
# provided, the object contained in the first document will be returned.
# +filename+ will be used in the exception message if any exception is raised
# while parsing.
#
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
#
# Example:
#
# Psych.load("--- a") # => 'a'
# Psych.load("---\n - a\n - b") # => ['a', 'b']
#
# begin
# Psych.load("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
# ex.message # => "(file.txt): found character that cannot start any token"
# end
def self.load yaml, filename = nil
result = parse(yaml, filename)
result ? result.to_ruby : result
end
###
# Parse a YAML string in +yaml+. Returns the first object of a YAML AST.
# +filename+ is used in the exception message if a Psych::SyntaxError is
# raised.
#
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
#
# Example:
#
# Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Sequence:0x00>
#
# begin
# Psych.parse("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
# ex.message # => "(file.txt): found character that cannot start any token"
# end
#
# See Psych::Nodes for more information about YAML AST.
def self.parse yaml, filename = nil
parse_stream(yaml, filename) do |node|
return node
end
false
end
###
# Parse a file at +filename+. Returns the YAML AST.
#
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
def self.parse_file filename
File.open filename, 'r:bom|utf-8' do |f|
parse f, filename
end
end
###
# Returns a default parser
def self.parser
Psych::Parser.new(TreeBuilder.new)
end
###
# Parse a YAML string in +yaml+. Returns the full AST for the YAML document.
# This method can handle multiple YAML documents contained in +yaml+.
# +filename+ is used in the exception message if a Psych::SyntaxError is
# raised.
#
# If a block is given, a Psych::Nodes::Document node will be yielded to the
# block as it's being parsed.
#
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
#
# Example:
#
# Psych.parse_stream("---\n - a\n - b") # => #<Psych::Nodes::Stream:0x00>
#
# Psych.parse_stream("--- a\n--- b") do |node|
# node # => #<Psych::Nodes::Document:0x00>
# end
#
# begin
# Psych.parse_stream("--- `", "file.txt")
# rescue Psych::SyntaxError => ex
# ex.file # => 'file.txt'
# ex.message # => "(file.txt): found character that cannot start any token"
# end
#
# See Psych::Nodes for more information about YAML AST.
def self.parse_stream yaml, filename = nil, &block
if block_given?
parser = Psych::Parser.new(Handlers::DocumentStream.new(&block))
parser.parse yaml, filename
else
parser = self.parser
parser.parse yaml, filename
parser.handler.root
end
end
###
# call-seq:
# Psych.dump(o) -> string of yaml
# Psych.dump(o, options) -> string of yaml
# Psych.dump(o, io) -> io object passed in
# Psych.dump(o, io, options) -> io object passed in
#
# Dump Ruby object +o+ to a YAML string. Optional +options+ may be passed in
# to control the output format. If an IO object is passed in, the YAML will
# be dumped to that IO object.
#
# Example:
#
# # Dump an array, get back a YAML string
# Psych.dump(['a', 'b']) # => "---\n- a\n- b\n"
#
# # Dump an array to an IO object
# Psych.dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
#
# # Dump an array with indentation set
# Psych.dump(['a', ['b']], :indentation => 3) # => "---\n- a\n- - b\n"
#
# # Dump an array to an IO with indentation set
# Psych.dump(['a', ['b']], StringIO.new, :indentation => 3)
#def self.dump o, io = nil, options = {}
def self.dump o, io = nil, options = {}
if Hash === io
options = io
io = nil
end
visitor = Psych::Visitors::YAMLTree.new options
visitor << o
visitor.tree.yaml io, options
end
###
# Dump a list of objects as separate documents to a document stream.
#
# Example:
#
# Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
def self.dump_stream *objects
visitor = Psych::Visitors::YAMLTree.new {}
objects.each do |o|
visitor << o
end
visitor.tree.yaml
end
###
# Dump Ruby object +o+ to a JSON string.
def self.to_json o
visitor = Psych::Visitors::JSONTree.new
visitor << o
visitor.tree.yaml
end
###
# Load multiple documents given in +yaml+. Returns the parsed documents
# as a list. If a block is given, each document will be converted to ruby
# and passed to the block during parsing
#
# Example:
#
# Psych.load_stream("--- foo\n...\n--- bar\n...") # => ['foo', 'bar']
#
# list = []
# Psych.load_stream("--- foo\n...\n--- bar\n...") do |ruby|
# list << ruby
# end
# list # => ['foo', 'bar']
#
def self.load_stream yaml, filename = nil
if block_given?
parse_stream(yaml, filename) do |node|
yield node.to_ruby
end
else
parse_stream(yaml, filename).children.map { |child| child.to_ruby }
end
end
###
# Load the document contained in +filename+. Returns the yaml contained in
# +filename+ as a ruby object
def self.load_file filename
File.open(filename, 'r:bom|utf-8') { |f| self.load f, filename }
end
# :stopdoc:
#domain_types = {}
def self.add_domain_type domain, type_tag, &block
key = ['tag', domain, type_tag].join ':'
#domain_types[key] = [key, block]
#domain_types["tag:#{type_tag}"] = [key, block]
end
def self.add_builtin_type type_tag, &block
domain = 'yaml.org,2002'
key = ['tag', domain, type_tag].join ':'
#domain_types[key] = [key, block]
end
def self.remove_type type_tag
#domain_types.delete type_tag
end
#load_tags = {}
#dump_tags = {}
def self.add_tag tag, klass
#load_tags[tag] = klass
#dump_tags[klass] = tag
end
class << self
attr_accessor :load_tags
attr_accessor :dump_tags
attr_accessor :domain_types
end
# :startdoc:
end
I have seen some references quoting
require 'yaml'
YAML::ENGINE.yamler = 'syck'
cannot find a config/boot.rb to try this.
I ripped out system wide ruby and the gems. Trying rvm and i still get similar errors :
I'm running hiera in debug mode :
[lame#TTBOX ~]$ hiera -d -c eye
Cannot find config file: eye
[lame#ipTTBOX ~]$ hiera -d eye
DEBUG: 2014-11-25 05:47:37 +0700: Hiera YAML backend starting
DEBUG: 2014-11-25 05:47:37 +0700: Looking up eye in YAML backend
DEBUG: 2014-11-25 05:47:37 +0700: Looking for data source default
/home/lame/.rvm/gems/ruby-2.1.5/gems/psych-2.0.6/lib/psych.rb:370:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 238 column 3 (Psych::SyntaxError)
from /home/lame/.rvm/gems/ruby-2.1.5/gems/psych-2.0.6/lib/psych.rb:370:in `parse_stream'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/psych-2.0.6/lib/psych.rb:318:in `parse'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/psych-2.0.6/lib/psych.rb:245:in `load'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend/yaml_backend.rb:18:in `block (2 levels) in lookup'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/filecache.rb:53:in `read_file'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend/yaml_backend.rb:17:in `block in lookup'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:104:in `block in datasourcefiles'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:76:in `block in datasources'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:74:in `map'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:74:in `datasources'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:99:in `datasourcefiles'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend/yaml_backend.rb:16:in `lookup'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:206:in `block in lookup'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:203:in `each'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera/backend.rb:203:in `lookup'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/lib/hiera.rb:60:in `lookup'
from /home/lame/.rvm/gems/ruby-2.1.5/gems/hiera-1.3.4/bin/hiera:225:in `<top (required)>'
from /home/lame/.rvm/gems/ruby-2.1.5/bin/hiera:23:in `load'
from /home/lame/.rvm/gems/ruby-2.1.5/bin/hiera:23:in `<main>'
from /home/lame/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
from /home/lame/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
Are you suggesting me to have a look at the hiera file itself ?
Your error message says to look at line 238, column 3 of your yaml file. Check to see if you have any illegal characters there.
ok so I can get to active admin on local and my site just fine - within active admin I have the options to select from Pins or Users (my two models) on local, can see all of the pins and users in the db just fine. However, live (heroku) I can access active admin barnpix.com/admin and clicking on pins works just fine ..however when I click users I get a generic heroku error... please help why does this work in local but not live?
Omrails::Application.routes.draw do
get "pages/tagz"
get "pages/about"
get "posts/show"
get "posts/destroy"
root :to => 'pins#index'
get 'tags/:tag' , to: 'pins#index', as: :tag
get "posts", to: "posts#index"
resources :posts
resources :pins
get "users/show"
devise_for :users
match 'users/:id' => 'users#show', as: :user
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
devise_for :views
ActiveAdmin.routes(self)
ActiveAdmin.setup do |config|
# == Site Title
#
# Set the title that is displayed on the main layout
# for each of the active admin pages.
#
config.site_title = "BarnPix.com"
# Set the link url for the title. For example, to take
# users to your main site. Defaults to no link.
#
config.site_title_link = "http://www.barnpix.com"
# Set an optional image to be displayed for the header
# instead of a string (overrides :site_title)
#
# Note: Recommended image height is 21px to properly fit in the header
#
# config.site_title_image = "/images/logo.png"
# == Default Namespace
#
# Set the default namespace each administration resource
# will be added to.
#
# eg:
# config.default_namespace = :hello_world
#
# This will create resources in the HelloWorld module and
# will namespace routes to /hello_world/*
#
# To set no namespace by default, use:
# config.default_namespace = false
#
# Default:
# config.default_namespace = :admin
#
# You can customize the settings for each namespace by using
# a namespace block. For example, to change the site title
# within a namespace:
#
# config.namespace :admin do |admin|
# admin.site_title = "Custom Admin Title"
# end
#
# This will ONLY change the title for the admin section. Other
# namespaces will continue to use the main "site_title" configuration.
# == User Authentication
#
# Active Admin will automatically call an authentication
# method in a before filter of all controller actions to
# ensure that there is a currently logged in admin user.
#
# This setting changes the method which Active Admin calls
# within the controller.
config.authentication_method = :authenticate_admin_user!
# == Current User
#
# Active Admin will associate actions with the current
# user performing them.
#
# This setting changes the method which Active Admin calls
# to return the currently logged in user.
config.current_user_method = :current_admin_user
# == Logging Out
#
# Active Admin displays a logout link on each screen. These
# settings configure the location and method used for the link.
#
# This setting changes the path where the link points to. If it's
# a string, the strings is used as the path. If it's a Symbol, we
# will call the method to return the path.
#
# Default:
config.logout_link_path = :destroy_admin_user_session_path
# This setting changes the http method used when rendering the
# link. For example :get, :delete, :put, etc..
#
# Default:
# config.logout_link_method = :get
# == Root
#
# Set the action to call for the root path. You can set different
# roots for each namespace.
#
# Default:
# config.root_to = 'dashboard#index'
# == Admin Comments
#
# Admin comments allow you to add comments to any model for admin use.
# Admin comments are enabled by default.
#
# Default:
# config.allow_comments = true
#
# You can turn them on and off for any given namespace by using a
# namespace config block.
#
# Eg:
# config.namespace :without_comments do |without_comments|
# without_comments.allow_comments = false
# end
# == Batch Actions
#
# Enable and disable Batch Actions
#
config.batch_actions = true
# == Controller Filters
#
# You can add before, after and around filters to all of your
# Active Admin resources and pages from here.
#
# config.before_filter :do_something_awesome
# == Register Stylesheets & Javascripts
#
# We recommend using the built in Active Admin layout and loading
# up your own stylesheets / javascripts to customize the look
# and feel.
#
# To load a stylesheet:
# config.register_stylesheet 'my_stylesheet.css'
# You can provide an options hash for more control, which is passed along to stylesheet_link_tag():
# config.register_stylesheet 'my_print_stylesheet.css', :media => :print
#
# To load a javascript file:
# config.register_javascript 'my_javascript.js'
# == CSV options
#
# Set the CSV builder separator (default is ",")
# config.csv_column_separator = ','
#
# Set the CSV builder options (default is {})
# config.csv_options = {}
# == Menu System
#
# You can add a navigation menu to be used in your application, or configure a provided menu
#
# To change the default utility navigation to show a link to your website & a logout btn
#
# config.namespace :admin do |admin|
# admin.build_menu :utility_navigation do |menu|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# admin.add_logout_button_to_menu menu
# end
# end
#
# If you wanted to add a static menu item to the default menu provided:
#
# config.namespace :admin do |admin|
# admin.build_menu :default do |menu|
# menu.add label: "My Great Website", url: "http://www.mygreatwebsite.com", html_options: { target: :blank }
# end
# end
# == Download Links
#
# You can disable download links on resource listing pages,
# or customize the formats shown per namespace/globally
#
# To disable/customize for the :admin namespace:
#
# config.namespace :admin do |admin|
#
# # Disable the links entirely
# admin.download_links = false
#
# # Only show XML & PDF options
# admin.download_links = [:xml, :pdf]
#
# end
# == Pagination
#
# Pagination is enabled by default for all resources.
# You can control the default per page count for all resources here.
#
#config.default_per_page = 30
# == Filters
#
# By default the index screen includes a “Filters” sidebar on the right
# hand side with a filter for each attribute of the registered model.
# You can enable or disable them for all resources here.
#
# config.filters = true
end