How to achieve manual "dapr init " instead of command "dapr init " - dapr

in my company,because of network reason,often disconnect github.com, command of "dapr init" always failed,so I want to manual implement "dapr init " to instead of command "dapr init ", someone know detail of "dapr init" ? thx

Dapr is an Open Source Project, so you can take a look at the init cmd implementation here!

Related

Python_terraform lib does not apply init command during the initial start of the code

I am trying to invoke the terraform code using the python_terraform module but the issue is whenever I am trying to run the code for the first time it does not invoke the "terraform init" automatically, I have to manually execute the "terraform init" on the respective folder and then run my python code. Post that the second time the code runs perfectly there is no blockage in that.
Code Block:
tf = Terraform(working_dir='Terraform_Infra_code')
tfinitresp = tf.init(no_color=IsFlagged, refresh=False, capture_output=True)
print(''.join(tfinitresp[1]))
tfplanresp = tf.plan(no_color=IsFlagged, refresh=False, capture_output=True)
print(''.join(tfplanresp[1]))
tfapplyresp = tf.apply(no_color=IsFlagged, refresh=False, capture_output=True, skip_plan=True)
print(''.join(tfapplyresp[1]))
cmd = 'terraform output -json > /Downloads/temp/output.txt'
os.system(cmd)
Please let me know if I am missing out anything, all suggestions are welcome

Jenkins parameter cannot be recognized in command line

I want to create a simple job using NodeJS, Github and Jenkins.
There are an exchange what runs on two servers addresses:
for example, us.exchange.com and eu.exchange.com.
I created an environment variable named SERVERS_LOCATION,
browser.get(`http://${process.env.SERVERS_LOCATION}.exchange.com`);
and a Jenkins parameter named SERVERS_LOCATION_JEN which may takes two options - US and EU.
Also I created a pipeline in Jenkins where I want to run parameterized build by choose one or another option, for that I use pipeline script in jenkinsfile what looks like that:
pipeline{
agent any
options{
disableConcurrentBuilds()
}
stages{
stage("install npm"){
steps{
bat "npm install"
bat "npx webdriver-manager update --versions.chrome 76.0.3809.68"
}
}
stage("executing job"){
steps{
bat "SERVERS_LOCATION=%SERVERS_LOCATION_JEN% npx protractor config/conf.js"
}
}
}
}
The main idea is to take the choosen value from Jenkins variable SERVERS_LOCATION_JEN and put it to environment variable ${process.env.SERVERS_LOCATION}, which can be used in code for further calls.
But when I running this job I have an error:
'SERVERS_LOCATION' is not recognized as an internal or external command,operable program or batch file.
P.S. running that job from git-bash works fine. (Win10 Chrome browser)
Could you point me please what I am doing wrong?
You have to use "set" command to assign a value to a variable in batch, so please use the below code:-
bat "set SERVERS_LOCATION=%SERVERS_LOCATION_JEN% npx protractor config/conf.js"

Shell scripts using Cron can't execute shell commands

I'm trying to restart my server with cron. I've found this link:
https://help.openshift.com/hc/en-us/articles/202187644-Shell-scripts-using-Cron-or-action-hooks-can-t-execute-shell-commands
But does not work. This is my script:
#!/bin/bash
source /usr/bin/rhcsh
ctl_all restart
And this the output:
/usr/bin/rhcsh: line 7: source: filename argument required
source: usage: source filename [arguments]
/usr/bin/rhcsh: line 32: build_path: command not found
/usr/bin/rhcsh: line 33: build_ld_library_path: No such file or directory
*********************************************************************
You are accessing a service that is for use only by authorized users.
If you do not have authorization, discontinue use at once.
Any use of the services is subject to the applicable terms of the
agreement which can be found at:
https://www.openshift.com/legal
*********************************************************************
Welcome to OpenShift shell
This shell will assist you in managing OpenShift applications.
!!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
Shell access is quite powerful and it is possible for you to
accidentally damage your application. Proceed with care!
If worse comes to worst, destroy your application with "rhc app delete"
and recreate it
!!! IMPORTANT !!! IMPORTANT !!! IMPORTANT !!!
Type "help" for more info.
Command "quota" not found for app xxxxx, please check the node hosting this app
WARNING: This ssh terminal was started without a tty.
It is highly recommended to login with: ssh -t
Restarting services
/usr/bin/rhcsh: line 123: gear: No such file or directory
Any ideas?
Many thanks.
Edit:
Here is rhcsh script (The script has 300 lines, so I've uploaded to a server):
http://www6.zippyshare.com/v/99209351/file.html
Try this:
#!/bin/bash
gear restart --all-cartridges # same as: ctl_all restart
ctl_all is a wrapper function for /usr/bin/gear script.

How can I run mocha tests remotely on IntelliJ IDEA 13 (or WebStorm)?

IntelliJ IDEA 13 has really excellent support for Mocha tests through the Node.js plugin: https://www.jetbrains.com/idea/webhelp/running-mocha-unit-tests.html
The problem is, while I edit code on my local machine, I have a VM (vagrant) in which I run and test the code, so it's as production-like as possible.
I wrote a small bash script to run my tests remotely on this VM whenever I invoke "Run" from within IntelliJ, and the results pop up in the console well enough, however I'd love to use the excellent interface that appears whenever the Mocha test runner is invoked.
Any ideas?
Update: There's a much better way to do this now. See https://github.com/TechnologyAdvice/fake-mocha
Success!!
Here's how I did it. This is specific to connecting back to vagrant, but can be tweaked for any remote server to which you have key-based SSH privileges.
Somewhere on your remote machine, or even within your codebase, store the NodeJS plugin's mocha reporter (6 .js files at the time of this writing). These are found in NodeJS/js/mocha under your main IntelliJ config folder, which on OSX is ~/Library/Application Support/IntelliJIdea13. Know the absolute path to where you put them.
Edit your 'Run Configurations'
Add a new one using 'Mocha'
Set 'Node interpreter' to the full path to your ssh executable. On my machine, it's /usr/bin/ssh.
Set the 'Node options' to this behemoth, tweaking as necessary for your own configuration:
-i /Users/USERNAME/.vagrant.d/insecure_private_key vagrant#MACHINE_IP "cd /vagrant; node_modules/mocha/bin/_mocha --recursive --timeout 2000 --ui bdd --reporter /vagrant/tools/mocha_intellij/mochaIntellijReporter.js test" #
REMEMBER! The # at the end is IMPORTANT, as it will cancel out everything else the Mocha run config adds to this command. Also, remember to use an absolute path everywhere that I have one.
Set 'Working directory', 'Mocha package', and 'Test directory' to exactly what they should be if you were running mocha tests locally. These will not impact the test execution, but this interface WILL check to make sure these are valid paths.
Name it, save, and run!
Fully integrated, remote testing bliss.
1) In Webstorm, create a "Remote Debug" configuration, using port 5858.
2) Make sure that port is open on your server or VM.
3) On the remote server, execute Mocha with the --debug-brk option: mocha test --debug-brk
4) Back in Webstorm, start the remote-debug you created in Step 1, and and execution should pause on set breakpoints.

TortoiseProc CruiseControl.NET: Unable to execute file problem

I am new to CruiseControl and automated build. My problem is that the ccnet service always promt me "unable to execute file TortoiseProc.exe /command ...". My config file looks like this
TortoiseProc.exe /command:update /path:C:\Work\global.ad.lib.objectmanagement /closeonend:1
This command(tortoiseProc....) works well in a CMD window. The Ccnet service is execute with an Admin account. "C:\Program Files\TortoiseSVN\bin" is in the environnement variables and can be executed from anywhere. If i force a build from the Dashboard, it builds perfectly. I have the feeling this is just a simple stupid thing...
Tks
You will need to specify TortoiseProc.exe parameters separately from the executable name, inside "buildArgs" element. Here is the right ccnet.config fragment for your situation:
<exec>
<description>Execute TortoiseProc.exe</description>
<baseDirectory>c:\path\to\tortoiseproc\folder</baseDirectory>
<executable>TortoiseProc.exe</executable>
<buildArgs>/command:update /path:C:\Work\global.ad.lib.objectmanagement /closeonend:1</buildArgs>
</exec>
Also you can create cmd-file with your commands and use exec without parameters, if that would be easier for you.

Resources