I wanna To Create some configuration File such as:
Config File:
username="your username"
password="your pass"
option 3
option 4
option 5
option 6
On the first time of run it will said File : "Config" as been created
with the Property:
after that, the user fill that file
And on the next run it will Get the information from the file.
How I can create in powershell file with Lines(each line is another propery) Or Create File with content of Properties
And how I can do read from file and get the propry
I mean how i can Create by properyies and how I import it
You can use the following :
Puting config to file
$a = [PSCustomObject]#{"username"="toto";"Pwd"="XXXX";"Option1"="o1"}
$a | Export-Clixml c:\temp\confif.txt
Getting config from file :
$b = Import-Clixml c:\temp\confif.txt
Related
I run my dbt command in a loop and save its contents to a .yml file. This works well and generates a schema in my .yml file accurately:
for file in models/l30_mart/*.sql; do
table=$(basename "$file" .sql)
dbt run-operation generate_model_yaml --args "{\"model_name\": \"$table\"}" > test.yml
done
However, in the example above, I am just saving the test.yml file in the root directory. When I try to save the file in another path for example models/l30_mart/test.yml, it doesn't work:
for file in models/l30_mart/*.sql; do
table=$(basename "$file" .sql)
dbt run-operation generate_model_yaml --args "{\"model_name\": \"$table\"}" > models/l30_mart/test.yml
done
In this case, when I open the test.ymlfile, I see this:
12:06:42 Running with dbt=1.0.1
12:06:43 Encountered an error:
Compilation Error
The schema file at models/l30_mart/test.yml is invalid because no version is specified. Please consult the documentation for more information on schema.yml syntax:
https://docs.getdbt.com/docs/schemayml-files
It's probably a syntax mistake. Do I need any quotes to specify the path? or brackets? Why can't I save the .yml file in the same folder? Similarly, something like this and try to save different files with the tablename, it also doesn't work:
for file in models/l30_mart/*.sql; do
table=$(basename "$file" .sql)
dbt run-operation generate_model_yaml --args "{\"model_name\": \"$table\"}" > models/l30_mart/$table.yml
done
In this case, the files either have this output:
20:39:44 Running with dbt=1.0.1
20:39:45 Encountered an error:
Compilation Error
The schema file at models/l30_mart/firsttable.yml is invalid because no version is specified. Please consult the documentation for more information on schema.yml syntax:
https://docs.getdbt.com/docs/schemayml-files
or this (eg in the second tablename.yml file):
20:39:48 Running with dbt=1.0.1
20:39:49 Encountered an error:
Parsing Error
Error reading dbt_4flow: l30_mart/firstablename.yml - Runtime Error
Syntax error near line 2
------------------------------
1 | 20:39:44 Running with dbt=1.0.1
2 | 20:39:45 Encountered an error:
3 | Compilation Error
4 | The schema file at models/l30_mart/firsttablename.yml is invalid because no version is specified. Please consult the documentation for more information on schema.yml syntax:
5 |
Raw Error:
------------------------------
mapping values are not allowed in this context
in "<unicode string>", line 2, column 31
Note that the secondtablename.yml mentions the firsttablename.yml.
I have defined 3 steps in my deploy process:
Generate password (Run a Script)
Deploy admin API (Deploy an IIS Web Site)
Deploy public API (Deploy an IIS Web Site)
In step 1, I use following PowerShell script to generate random password:
[Reflection.Assembly]::LoadWithPartialName("System.Web")
$pwd = [System.Web.Security.Membership]::GeneratePassword(15,2)
Set-OctopusVariable -name "Password" -value $pwd -sensitive
There are some variables defined in the project under Variables section, and they correctly replace corresponding values in config files in step 2 and 3.
My question is, how to use Password variable from step 1 to replace corresponding fields in config files in steps 2 and 3?
You need to use the name of the step that the variable was created in when you retrieve it:
In the config file (in the package for steps 2 and 3) use a value like this:
#{Octopus.Action[NameOfStep1].Output.Password}
Problem: In debug mode I can run test plan with no issues, but in none-gui got problem while parsing access to file, looks like properties file.
Here are details:
jmeter.logs
2018-08-31 13:26:30,831 ERROR o.a.j.t.JMeterThread: Test failed!
java.lang.IllegalArgumentException: File 2 must exist and be readable at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:424) ~[ApacheJMeter_core.jar:4.0 r1823414]
My Test Plan:
enter image description here
External property file contain link to other file with list of users.
enter image description here
Here is my Test Plan and property file reader sampler.
Both files SAT.properties, SAT.users.22315010.csv have full access
-rwxrwx---+ 1 Domain Users 212 Aug 31 12:41 SAT.properties
-rwxrwx---+ 1 Domain Users 123 Aug 30 13:20 SAT.users.22315010.csv
Cmd command used to run script:
jmeter -n -t D:\PW\Automation\Jmeter\Reports\Reports_Random.jmx -Jusers=1 -l D:\PW\Automation\Jmeter\Reports\Results\JResults.jtl
The answer lies in Property File Reader comments, you need to escape your path:
If you want c:\abc , You need to have c:\abc as value in your property file as \ is used for escape sequence in Java
I don't think using this "property file reader" makes sense as the functionality of reading an external properties file is available right out of the box in JMeter.
Instead of using the plugin you can just pass the path to your SAT.properties file using -q command-line argument like:
jmeter -q d:\PW\Automation\JMeter\Reports\Properties\SAT.properties -n -t D:\PW\Automation\Jmeter\Reports\Reports_Random.jmx -Jusers=1 -l D:\PW\Automation\Jmeter\Reports\Results\JResults.jtl
More information:
Configuring JMeter
Apache JMeter Properties Customization Guide
I am using rsyslog version 8.16.0 on ubuntu 16.04.
Following is my configuration file :
module(load="imfile") #needs to be done just once
# File 1
input(type="imfile"
mode="inotify"
File="/var/log/application/hello.log"
Tag="application-access-logs"
Severity="info"
PersistStateInterval="20000"
)
$PrivDropToGroup adm
$WorkDirectory /var/spool/rsyslog
$InputRunFileMonitor
#Template for application access events
$template ApplicationLogs,"%HOSTNAME% %msg%\n"
if $programname == 'application-access-logs' then ##xx.xx.xx.xx:12345;ApplicationLogs
if $programname == 'application-access-logs' then ~
I am getting the following error :
rsyslogd: version 8.16.0, config validation run (level 1), master config /etc/rsyslog.conf
rsyslogd: error during parsing file /etc/rsyslog.d/21-application-test.conf, on or before line 10: parameter 'mode' not known -- typo in config file? [v8.16.0 try http://www.rsyslog.com/e/2207 ]
rsyslogd: imfile error: no file name given, file monitor can not be created [v8.16.0 try http://www.rsyslog.com/e/2046 ]
What I am doing wrong here ?
I am using inotify mode because I want to use wildcards in file name.
I know this is not a complete answer but an observation that can help others struggling with the same issue.
module(load="imfile" mode="inotify") is set globally so if any other .conf file has module property set it seems to throw this error for any future files.
I need to recover the content of the show log module of Omnet++/Tkenv into a file, I added in the omnetpp.ini:
cmdenv-express-mode = false
cmdenv-output-file = log.txt
but I have two types of problems:
1) after the simulation, I did not find the "log.txt" If I do not create it
2) and when I created it before launching the simulation under ../omnetpp-4.6/log.txt also I find it empty
I used EV << to display the content of variables that I used, I need to resolve this problem in order to analyze the traffic so how can I do that please?
You have to start your simulation in Cmdenv mode. To do that go to Run | Run Configurations | select your configuration, then select Command line as User interface. The log file is created in simulations directory by default.