ohai
{
"kernel": {
"name": "Linux",
"release": "3.13.0-165-generic",
"version": "#215-Ubuntu SMP Wed Jan 16 11:46:47 UTC 2019",
"machine": "x86_64",
"processor": "x86_64",
"os": "GNU/Linux",
"modules": {
"vboxsf": {
"size": "43798",
"refcount": "2",
"version": "4.3.36_Ubuntu (interface 0x00010004)"
},
"nfsd": {
"size": "284396",
"refcount": "2"
},
"auth_rpcgss": {
"size": "59309",
"refcount": "1"
},
...
еще 100500 конфигурации системы.. iptables::test:
ip:
1.1.1.1: 'adm-1'
2.2.2.2: 'adm-2'
3.3.3.3: 'adm-3'
$variable1 = hiera('iptables::test.ip')
$variable2 = inline_template( "<% @variable1.each do |key,value| %>Allow From <%=key %> #<%=value %>\n<% end -%>")
notify { "result: ${variable2}": }
result:
Allow From 1.1.1.1 #adm-1
Allow From 2.2.2.2 #adm-2
Allow From 3.3.3.3 #adm-3
/usr/share/tomcat/bin/catalina.sh stop
pushd /usr/share/tomcat/webapps
cp -R helloworld/ ROOT
/usr/share/tomcat/bin/catalina.sh start
(в helloworld был учебный сервлет типа вашего)curl http://localhost:8080/hello
<h1> Hello world </h1>
JsonParser parser = new JsonParser();
JsonObject jsonObject = parser.parse(ваша строка)
.getAsJsonObject();
assertTrue(jsonObject.isJsonObject());
String result = jsonObject.toString();
System.err.println("Result: " + result);
/opt/tomcat/webapps/helloworld/WEB-INF/classes/sample/HelloWorld.class
/opt/tomcat/webapps/helloworld/WEB-INF/web.xml
/opt/tomcat/webapps/helloworld/WEB-INF/sample/HelloWorld.java
head ./sample/HelloWorld.java
package sample;
ваш код
<servlet-class>sample.HelloWorld</servlet-class>
javac -cp /opt/tomcat/lib/servlet-api.jar sample/HelloWorld.java ;
mkdir -p classes/sample/ ;
mv sample/HelloWorld.class classes/sample/
/opt/tomcat/bin/catalina.sh stop;
/opt/tomcat/bin/catalina.sh start
catalina.out
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/helloworld] has finished in [51] ms
curl http://localhost:8080/helloworld/hello
<h1> Apple </h1>r
remove-item -path 'not existing.txt' -erroraction silentlycontinue; echo $?
False
new-item -path 'dummy.txt'
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 11/17/2019 8:24 PM 0 dummy.txt
remove-item -path 'dummy.txt' -erroraction silentlycontinue; echo $?
True
<% response.sendRedirect("куда"); %>
ssh root@<ip-адрес vmbitrix>
List<String> OSes = Arrays
.asList(new String[] { "windows", "dos", "mac", "linux" });
Map<String, String> defaultBrowsers = new HashMap<>();
defaultBrowsers.put("windows", "Chrome");
defaultBrowsers.put("linux", "Firefox");
defaultBrowsers.put("mac", "Safari");
List<String> result = OSes.stream().filter(o -> {
return (defaultBrowsers.containsKey(o)) ? true : false;
}).collect(Collectors.toList());
throw new ResponseStatusException(HttpStatus.NOT_FOUND /* 404 */, "my message", new Exception(/* еще детали о том что случ лось */));