symfony 1.4.8+ doctrine --> doctrine:build-schema fatal error opening required /tmp/tmp_doctrine/User.php - symfony1

I'm trying out symfony so i started installing it on a remote mashine thru ssh (normal user, no root access)
when getting to the part where i want to generate the db-schema out of a existing mysql database with doctrine by issuing the following command:
./symfony doctrine:build-schema
i get the following errors:
Warning: require_once(): '/tmp/tmp_doctrine_models/User.php' is not a valid path for inclusions, since it includes /tmp/ in /home/users/mpretftp/test1/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php on line 668
Warning: require_once(/tmp/tmp_doctrine_models/User.php): failed to open stream: Success in /home/users/mpretftp/test1/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php on line 668
Fatal error: require_once(): Failed opening required '/tmp/tmp_doctrine_models/User.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/users/mpretftp/test1/lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Core.php on line 668
by 'doing it the other way around', create the database.yaml like this:
User:
actAs: { Timestampable: ~ }
columns:
id: { type: integer, notnull: true }
hash: { type: string(255), notnull: true }
then trying out ./symfony doctrine:build --model i'm getting the following, even weirder error:
./symfony doctrine:build --model
>> doctrine generating model classes
>> file+ /tmp/doctrine_schema_70737.yml
Invalid schema element named "0" at path "Warning"
also, the hoster (of the remote mashine) has a comment on a joomla-error message. On one side i realize that joomla has nothing to do with symfony nor doctrine. But the error message resembles the first warning i pasted above: "... is not a valid path for inclusions,since it includes '/tmp/' in ....". The suggested sollution for the joomla-error is changing the /tmp/ path to /home/users/user/tmp in the joomla configuration
my best guess would be that i need to convince doctrine to use another path as well. unfortunatly i cannot find such a configuration option for doctrine.
could anyone either tell me how to set the tmp path for doctrine/symfony or php or even the enviroment?, or where to continue 'debugging'?

Doctrine uses PHP's sys_get_temp_dir to determine the temporary path. I found this out by search the Doctrine source for 'tmp_doctrine_models'.
It seems a little strange that your host doesn't allow the temporary directory to be written.

Related

Error when running near indexer localnet, fail to generate config.json

So I'm trying to run the indexer on localnet following the official tutorial https://docs.near.org/docs/tutorials/near-indexer
However when I run cargo run -- init to generate the localnet json config I get this error
Finished dev [unoptimized + debuginfo] target(s) in 17.62s
Running `target/debug/example-indexer init`
thread 'main' panicked at 'Failed to deserialize config: Error("expected value", line: 1, column: 1)', /home/francois/.cargo/git/checkouts/nearcore-5bf7818cf2261fd0/a44be20/nearcore/src/config.rs:499:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
At some point it seems the json is not created or not created properly I guess, the function crashing in config.rf line 499 is
impl From<&str> for Config {
fn from(content: &str) -> Self {
serde_json::from_str(content).expect("Failed to deserialize config")
}
}
It's quite difficult to debug since cargo run -- init is using some inner near function (also I'm new to rust).
the config.json file is created but it seems the permission are not set properly by the script, the content of config.json is
"<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message> ... "
If anyone from the community has encountered this problem or has a hint it would be great!! thanks a lot !
In the tutorial you referenced, it mentions a similar error, and suggests the following:
Open your config.json located in the .near folder in the root of your home directory. ( ~/.near/config.json )
In this file, locate: "tracked_shards": [] and change the value to [0].
Save the file and try running your indexer again.
So I had the wrong config with download_config: false,
It should be download_config: false, for the localnet use

swagger-codegen is not correctly generating common parameters for any language

According to the swagger documentation, I should be able to have common parameters that are shared by all operations. The problem is that when running codegen locally, the generated code does not have any of the common path parameters. The below yaml produces code for any language (I've tried two).
What is very confusing is that if I use this exact yaml in https://editor.swagger.io/, the generated code does have the path parameters. I ran this for two different languages, typescript:
And C#:
Left is the code generated in editor.swagger.io and right is my generated code by running codegen locally.
In both cases, the .swagger-codegen\VERSION the file is 3.0.20 which is the one I'm using but the code generated by https://editor.swagger.io/ does have the parameter paths.
This simple yaml file reproduces the issue:
openapi: 3.0.2
info:
title: title
version: 1.0.0
paths:
'/instances/{id}':
summary: Manipulate a particular instance
get:
responses:
'200':
description: Ok
content:
text/plain:
schema:
type: string
example: pong
summary: Fetches an instance
parameters:
- in: path
name: id
schema:
type: integer
required: true
components:
securitySchemes:
bearerAuth:
scheme: bearer
bearerFormat: JWT
type: http
The command line used for generation:
java ^
-classpath bin/swagger-codegen-cli.jar ^
-DdebugOperations ^
io.swagger.codegen.v3.Codegen ^
generate ^
-i enterpos-api.yaml ^
-l typescript-angular ^
-o generated-code/typescript-angular-builtin
And that generated this output: https://gist.github.com/alanboy/45ce792255e079dd0de4f70449ebf455. I feel like this might be wrong usage or something wrong with my yaml but I can't figure out what.
The problem is the Main class. I noticed that using the io.swagger.codegen.v3.Codegen class produces incorrect results :
java -classpath bin/swagger-codegen-cli.jar io.swagger.codegen.v3.Codegen <more>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
But this works:
java -jar bin/swagger-codegen-cli.jar <more>
Which led me to open MANIFEST.MF in the jar and notice the main class is actually this:
Main-Class: io.swagger.codegen.v3.cli.SwaggerCodegen
I then ran the command like this and everything worked as expected.
java -classpath bin/swagger-codegen-cli.jar io.swagger.codegen.v3.cli.SwaggerCodegen <more>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

How do I configure SaltStack to transfer a file (or install a package) for the first time?

I am running two instances of RedHat. I have SaltMaster installed on one machine and SaltMinion installed on another. I am using a free version of Salt. I want to test SaltStack to do a basic configuration management task. If it can transfer a file from SaltMaster to SaltMinion, that would be great. If it can install Apache web server on SaltMinion, that would be great. Either task will help me learn. My learning goal is semi-flexible.
I can use salt '*' test.ping. The response is True. I tried this command: salt '*' state.apply
I got this error:
> hostname.fqdn:
> Data failed to compile:
> ----------
> No matching salt environment for environment 'qa' found
> ----------
> No matching sls found for 'qa1' in env 'qa'
> ----------
> No matching sls found for 'base1' in env 'base'
> ----------
> No matching salt environment for environment 'dev' found
> ----------
> Specified SLS base1 in saltenv dev is not available on the salt master or through a configured fileserver
I modified the /etc/salt/master file. I uncommented these lines:
fileserver_backend:
- git
- roots
I tried this command again: salt '*' state.apply
I received this error:
> [ERROR ] Error parsing configuration file: /etc/salt/master -
> expected '<document start>', but found '<block mapping start>' in
> "<string>", line 547, column 1:
> fileserver_backend:
> ^ [ERROR ] Error parsing configuration file: /etc/salt/master - expected '<document start>', but found '<block mapping start>' in
> "<string>", line 547, column 1:
> fileserver_backend:
> ^
I have been following these directions here:
https://docs.saltstack.com/en/latest/topics/tutorials/states_pt1.html
I created a webserver.sls file.
I inserted these lines as the content:
apache: # ID declaration
pkg: # state declaration
- installed # function declaration
I do not see how the three lines in the directions above would be enough to configure SaltStack to work. Where would the apache installation media need to be? Where would the transfer happen from? Am I supposed to download the media to SaltMaster? I would assume so. But where would I put it? I have a satellite server for yum commands to work.
Alternatively, how do I get SaltStack to transfer a file from SaltMaster to SaltMinion?
The first error ([...]No matching sls found for 'qa1' in env 'qa'[...]) indicates that you have configured a lot of different environments (file_roots), which are not present on your master's filesystem. Your approach to solve this goes in the correct direction, but leads to this error:
[ERROR ] Error parsing configuration file: /etc/salt/master - expected '', but found '' in "", line 547, column 1: fileserver_backend: ^ [ERROR ] Error parsing configuration file: /etc/salt/master - expected '', but found '' in "", line 547, column 1: fileserver_backend: ^
You should no longer be able to test.ping your minion, as the salt master should not run anymore, does it? To solve it just read the error message. It tells you with which point in your salt master configuration file salt is unhappy.
The fileserver_backend configures which types of backend should be available. You should check the file_roots configuration to actually define which roots are available. Roots refer to salt states folders in your filesystem.
A very simple config might look like that:
file_roots:
base:
- /srv/salt
It assumes that /srv/salt is the root of your state tree - which effectively means, that your webserver.sls should be located in this folder.
Your webserver.sls looks promising - it should install apache2 on a minion, when you apply it.
Managing configuration files on the master and transferring them to the minions is something salt can easily achieve. A simple state might look like:
/etc/myawesomeconfigurationfile.conf:
file.managed:
source: salt://myawesomefile # refers to /srv/salt/myawesomefile
user: root
group: root
mode: 640
You also asked for media files that you want to manage. If you talk about application related data it is not a good idea to use salt to move them around. IMO other approaches like NFS, GlusterFS or anything else that decouples user content from your application would be a better approach.

Assetic dump reveals "_settings.scss failed to import not found or unreadable"

I have been learning how to use assetic filters and integrating compass/foundation5 through assetics. When I attempt to use assetic:dump I get a mess of errors and despite my best efforts I have yet to find the solution. First off I think the root of the error lies here.
Output:
error assetic_compassyGuG5K.scss (Line 13 of src/test/CoreBundle/Resources/public/scss/_settings.scss: File to import not found or unreadable: foundation/functions.
Load paths:
/tmp
/home/test/.rvm/gems/ruby-2.1.2/gems/compass-0.12.6/frameworks/blueprint/stylesheets
/home/test/.rvm/gems/ruby-2.1.2/gems/compass-0.12.6/frameworks/compass/stylesheets
/var/www/test.local/public_html/src/test/CoreBundle/Resources/public/scss
I have attempted to do anything I can think of to clear the error (aside removing the filter completely, which would fix it). I even attempted to use foundation to load the site and though I got rid of this error it was replaced by a error stating that the foundation.xml could not be located.
My question is do I need to add the config.rb to the filter to define the locations or am I missing something all together in the filter?
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: true
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
compass:
bin: /home/nathan/.rvm/gems/ruby-2.1.2/bin/compass
apply_to: "/.scss$"
#closure:
# jar: "%kernel.root_dir%/Resources/java/compiler.jar"
#yui_css:
# jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
parameters:
assetic.ruby.bin: /home/nathan/.rvm/rubies/ruby-2.1.2/bin/ruby
The apply_to checks a regular expression, and \ indicates that the next character will be escaped (dot in this case), then, / should be replaced with \.

psql ERROR: relation already exists

I'm writing a rails project using postgres and there is some data in the server. And I want dump the data from the remote end to the local, so I write script to do it, but some errors come out.
This's the dump script:
run "PGPASSWORD='#{remote_settings['password']}'
pg_dump -U #{remote_settings["username"]} #{"-h '#{remote_settings["host"]}'"
if remote_settings["host"]}
'#{remote_settings["database"]}' > #{remote_sql_file_path}"
There's some codes to transport..
Transport codes
And this's the restore script:
run_locally "PGPASSWORD='#{local_settings['password']}' psql -U
#{local_settings["username"]} -d #{local_settings["database"]}
-f #{local_sql_file_path}"
I get the data file successfully, but when there're some ERRORs* when **restore script is run:
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:46: ERROR: relation "refinery_images" already exists
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:49: ERROR: role "ib5k" does not exist
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:60: ERROR: relation "refinery_images_id_seq" already exists
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:63: ERROR: role "ib5k" does not exist
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:83: ERROR: relation "refinery_page_part_translations" already exists
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:86: ERROR: role "ib5k" does not exist
...
sql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:525: ERROR: duplicate key value violates unique constraint "refinery_images_pkey"
DETAIL: Key (id)=(1) already exists.
CONTEXT: COPY refinery_images, line 2: ""
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:547: ERROR: duplicate key value violates unique constraint "refinery_page_part_translations_pkey"
DETAIL: Key (id)=(1) already exists.
CONTEXT: COPY refinery_page_part_translations, line 8: ""
psql:tmp/production-ib5k_production-2013-02-21_18:42:09.sql:569: ERROR: duplicate key value violates unique constraint "refinery_page_parts_pkey"
DETAIL: Key (id)=(1) already exists.
CONTEXT: COPY refinery_page_parts, line 8: ""
...
And the database in local will not be updated.
I want to know how to solve it? Adding some arguments? Thank you in advance.
You can use the -c or --clean argument to pg_dump. That argument will drop existing database objects before running the commands to create them.
An alternative is to drop those objects yourself before restoring. (Probably using drop schema or drop database.)
Use with caution.

Resources