TRAC XMLRPC Plugin fails to retrieve tickets, even though debug log shows results from Trac[query] - trac

I have a functioning python script that will pull all sorts of information from TRAC XMLRPC except a ticket.query. From the debug log I can see that the query comes in and is processed and finds four (4) tickets; however the return is empty.
I have replaced the ServerProxy site with http://trac-hacks.org/rpc, and it works.
Configuration:
Trac 1.0.1
Apache 2.2
XMLPRC plugin 1.1.5
Python 2.7.6
Active Directory
Code:
from xmlrpclib import *
p = ServerProxy('http://user:password#host/trac/project/login/xmlrpc')
print p.system.getAPIVersion()
print p.ticket.query("max=0&status!=closed")
Return:
[1, 1, 5]
[]
Debug Log:
2016-07-07 07:46:42,240 Trac[web_ui] DEBUG: RPC incoming request of content type 'text/xml' dispatched to <tracrpc.xml_rpc.XmlRpcProtocol object at 0x03D3E630>
2016-07-07 07:46:42,240 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'user'
2016-07-07 07:46:42,240 Trac[xml_rpc] DEBUG: RPC(xml) call by 'user', method 'ticket.query' with args: ('max=0&status!=closed',)
2016-07-07 07:46:42,240 Trac[web_ui] DEBUG: RPC(XML-RPC) call by 'user' ticket.query
2016-07-07 07:46:42,240 Trac[query] DEBUG: Count results in Query: 4
2016-07-07 07:46:42,240 Trac[xml_rpc] DEBUG: RPC(xml) 'ticket.query' result: []

Related

How to strip extra characters from ansible_kernel

I'm trying to find a way to strip the characters with respect to the ansible_kernel variable. As of now, it outputs something like this:
3.10.0-1127.18.2.el7.x86_64
I just need the first 4 characters (3.10) as I'm looking to write a conditional task for kernel versions that match a specific value.
I attempted to follow the example here but, I just get a hello world as my output:
How to compare kernel (or other) version numbers in Ansible
Here is my simple code:
- name: check kernel
hosts: all
gather_facts: yes
vars:
kernel_version: "{{ansible_kernel}}"
tasks:
- debug:
var: kernel_version
- set_fact: release="{{ kernel_version }}"
- debug:
var: release
- debug:
msg:"Version is {{'release'[:5]}}" //also tried with release.stdout but I get an error
Output of play:
ASK [debug] *******************************************************************
ok: [server] => {
"kernel_version": "3.10.0-1127.18.2.el7.x86_64"
}
TASK [set_fact] ****************************************************************
ok: [server]
TASK [debug] *******************************************************************
ok: [server] => {
"release": "3.10.0-1127.18.2.el7.x86_64"
}
TASK [debug] *******************************************************************
ok: [server] => {
"msg": "Hello world!"
Use split. For example, split the version by dots, select the first two elements, and join them again
- set_fact:
ver: "{{ kernel_version.split('.')[:2]|join('.') }}"
gives
ver: '3.10'
Split by dash '-' and take the first element
- set_fact:
ver: "{{ kernel_version.split('-')|first }}"
gives the full version
ver: 3.10.0
Use Comparing versions to test versions. For example
- debug:
msg: Version higher than 3.0.0
when: ver is version('3.0.0', '>')
- debug:
msg: Version lower than 3.0.0
when: ver is version('3.0.0', '<')
give
TASK [debug] ****
ok: [localhost] =>
msg: Version higher than 3.0.0
TASK [debug] ****
skipping: [localhost]
here is how you could do it. Try:
- name: check kernel
hosts: localhost
gather_facts: yes
tasks:
- debug:
msg: "Stripped version {{ ansible_kernel[0:4] }}"
- debug:
msg: "The version is greater 0.2: {{ ansible_kernel is version_compare('0.2', operator='gt') }}"
- debug:
msg: "The version is smaller 0.2: {{ ansible_kernel is version_compare('0.2', operator='lt') }}"
The first one demonstrates how you could get the first 4 characters. It is unsuitable for your purpose, though (what about the version 3.1.4 -> would yield 3.1.
You should go with version_compare (see the other examples). Since ansible 2.9 this is the right syntax

Cannot get current URL in Selenium::Remote::Driver in perl

I navigated to google and called the get_current_url() method. but it's showing timeout and exiting the program.
Here is the code I tried
my $driver = Selenium::Remote::Driver->new(
'browser_name' => 'firefox',
'platform' => 'Windows',
'extra_capabilities' => {
'moz:firefoxOptions' => {},
}
);
$driver->debug_on() ;
$driver->get("https://www.google.com/");
wait_until {print $driver->get_path()};
$driver->quit;
I've turned on debug and got the following output in console
Prepping get
Executing get
REQ: POST, http://localhost:4444/wd/hub/session/69ced133-9420-4b0e-a7fd-e4f6bb343f7e/url, {"url":"https://www.google.co.in/"}
RES: {"value":null}
Prepping getCurrentUrl
Executing getCurrentUrl
REQ: GET, http://localhost:4444/wd/hub/session/69ced133-9420-4b0e-a7fd-e4f6bb343f7e/url, {}
RES: read timeout at C:/Perl64/lib/Net/HTTP/Methods.pm line 268.
Error while executing command: Server returned error message read timeout at C:/Perl64/lib/Net/HTTP/Methods.pm line 268.
instead of data at C:/Perl64/site/lib/Selenium/Remote/Driver.pm line 403.
at C:/Perl64/site/lib/Selenium/Remote/Driver.pm line 353.
Prepping quit
Executing quit
REQ: DELETE, http://localhost:4444/wd/hub/session/69ced133-9420-4b0e-a7fd-e4f6bb343f7e, {}
In console,program stucks here for while- 'Executing getCurrentURL' and later shown up with timeout message-Res:read timeout
The following works for me using Windows 10, Strawberry Perl version 5.30.1.
I installed geckodriver.exe from
https://github.com/mozilla/geckodriver/releases
and Selenium Server from
https://www.selenium.dev/downloads/
then downloaded firefox binary from
https://www.mozilla.org/en-US/firefox/new/
and then started the server successfully from the command prompt:
> java "-Dwebdriver.gecko.driver=geckodriver/geckodriver.exe" -jar selenium-server/selenium-server-standalone-3.141.59.jar -host localhost -port 4444
20:00:48.591 INFO [GridLauncherV3.parse] - Selenium server version: 3.141.59, revision: e82be7d358
20:00:53.896 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4444
2020-07-06 20:00:54.601:INFO::main: Logging initialized #12170ms to org.seleniumhq.jetty9.util.log.StdErrLog
20:01:05.928 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet
20:01:23.567 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
Now the following Perl script works:
use feature qw(say);
use strict;
use warnings;
use Selenium::Remote::Driver;
my $driver = Selenium::Remote::Driver->new(
remote_server_addr => "127.0.0.1"
);
$driver->get('http://www.google.com');
say "Result: ", $driver->get_title();
$driver->quit();
Output:
Result: Google
Note: using localhost instead of 127.0.0.1 for remote_server_addr does not work for some reason, see this question for more information.

Sonarqube not Importing issues reported by OCLint

I am doing Objective-C code analysis by using sonarqube. The configuration is as below:
SonarQube 5.4
Objective-C (Community) 5.0.0
xcode 6
xctool
OCLint 0.10.2
The OCLint doing the analysis and puting it in to the sonar-reports/oclint.xml. But nothing is coming-up on sonar dashboard.
Following is the log:
Running run-sonar.sh...
Xcode workspace file is:
Xcode project file is: demo.xcodeproj
Xcode application scheme is: demo
Xcode test scheme is:
Excluded paths from coverage are:
-n Extracting Xcode project information
+ xctool -project demo.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme demo clean
[Info] Loading settings for scheme 'demo' ... (3057 ms)
=== CLEAN ===
xcodebuild clean demo
demo / demo (Debug)
✓ Check dependencies (363 ms)
✓ Remove demo.app (73 ms)
✓ Remove demo.app.dSYM (73 ms)
✓ Remove demo.build (132 ms)
0 errored, 0 warning (526 ms)
demo / demoTests (Debug)
✓ Check dependencies (0 ms)
✓ Remove demoTests.xctest (1 ms)
✓ Remove demoTests.xctest.dSYM (1 ms)
✓ Remove demoTests.build (3 ms)
0 errored, 0 warning (5 ms)
xcodebuild build clean
demo / demo (Debug)
✓ Check dependencies (119 ms)
✓ Create product structure (0 ms)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
/bin/mkdir -p /Users/vikas/Library/Developer/Xcode/DerivedData/demo-bjvmeyunxomqaoezclqtsosfosgc/Build/Products/Debug-iphonesimulator/demo.app
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Remove demo.app.dSYM (0 ms)
✓ Remove demo.build (0 ms)
✓ Remove demo.app (1 ms)
0 errored, 0 warning (124 ms)
demo / demoTests (Debug)
✓ Check dependencies (0 ms)
✓ Create product structure (0 ms)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
/bin/mkdir -p /Users/vikas/Library/Developer/Xcode/DerivedData/demo-bjvmeyunxomqaoezclqtsosfosgc/Build/Products/Debug-iphonesimulator/demoTests.xctest
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ Remove demoTests.xctest (0 ms)
✓ Remove demoTests.xctest.dSYM (0 ms)
✓ Remove demoTests.build (0 ms)
0 errored, 0 warning (3 ms)
** CLEAN SUCCEEDED ** (2229 ms)
+ returnValue=0
+ set +x
+ xctool -project demo.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme demo -reporter json-compilation-database:compile_commands.json build
+ returnValue=0
+ set +x
Skipping tests as no test scheme has been provided!
-n Running OCLint...
-n Path included in oclint analysis is: --include .*/demo/demo/..
+ oclint-json-compilation-database --include ../demo/demo/.. -- -max-priority-1 10000 -max-priority-2 10000 -max-priority-3 10000 -report-type pmd -o sonar-reports/oclint.xml
+ returnValue=0
+ set +x
-n Running SonarQube using SonarQube Runner
+ sonar-runner -X
INFO: Scanner configuration file: /usr/local/Cellar/sonar-runner/2.5/libexec/conf/sonar-runner.properties
INFO: Project configuration file: /Users/vikas/Documents/projects/demo/sonar-project.properties
INFO: SonarQube Scanner 2.5
INFO: Java 1.8.0_25 Oracle Corporation (64-bit)
INFO: Mac OS X 10.10.2 x86_64
INFO: Error stacktraces are turned on.
DEBUG: cache: /Users/vikas/.sonar/ws_cache/http%3A%2F%2Flocalhost%3A9000/global
INFO: User cache: /Users/vikas/.sonar/cache
DEBUG: Extract sonar-runner-batch in temp...
DEBUG: Get bootstrap index...
DEBUG: Download: http://localhost:9000/batch_bootstrap/index
DEBUG: Get bootstrap completed
DEBUG: Create isolated classloader...
DEBUG: Start temp cleaning...
DEBUG: Temp cleaning done
DEBUG: Execution getVersion
DEBUG: Execution start
DEBUG: Publish global mode
DEBUG: cache: /Users/vikas/.sonar/ws_cache/http%3A%2F%2Flocalhost%3A9000/global
INFO: Load global repositories
DEBUG: GET 200 http://localhost:9000/batch/global | time=121ms
INFO: Load global repositories (done) | time=532ms
INFO: User cache: /Users/vikas/.sonar/cache
INFO: Load plugins index
DEBUG: GET 200 http://localhost:9000/deploy/plugins/index.txt | time=6ms
INFO: Load plugins index (done) | time=7ms
DEBUG: Load plugins
DEBUG: Load plugins (done) | time=325ms
DEBUG: API compatibility mode is enabled on plugin C# [csharp] (built with API lower than 5.2)
DEBUG: API compatibility mode is enabled on plugin Java [java] (built with API lower than 5.2)
DEBUG: API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
DEBUG: API compatibility mode is enabled on plugin Objective-C (Community) [objectivec] (built with API lower than 5.2)
DEBUG: API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
DEBUG: API compatibility mode is enabled on plugin JavaScript [javascript] (built with API lower than 5.2)
DEBUG: Plugins:
DEBUG: * C# 4.4 (csharp)
DEBUG: * Java 3.10 (java)
DEBUG: * Git 1.0 (scmgit)
DEBUG: * Objective-C (Community) 0.5.0-SNAPSHOT (objectivec)
DEBUG: * SVN 1.2 (scmsvn)
DEBUG: * JavaScript 2.10 (javascript)
INFO: Default locale: "en_US", source code encoding: "UTF-8"
DEBUG: Work directory: /Users/vikas/Documents/projects/demo/.sonar
DEBUG: Execution getVersion
DEBUG: Execution execute
INFO: Process project properties
DEBUG: Process project properties (done) | time=3ms
DEBUG: cache: /Users/vikas/.sonar/ws_cache/http%3A%2F%2Flocalhost%3A9000/5.4/projects/OCD1
INFO: Load project repositories
DEBUG: GET 404 http://localhost:9000/batch/project.protobuf?key=OCD1 | time=56ms
DEBUG: Project repository not available - continuing without it
INFO: Load project repositories (done) | time=87ms
INFO: Apply project exclusions
DEBUG: Available languages:
DEBUG: * C# => "cs"
DEBUG: * Java => "java"
DEBUG: * Objective-C (Community) => "objectivec"
DEBUG: * JavaScript => "js"
INFO: Load quality profiles
DEBUG: GET 200 http://localhost:9000/api/qualityprofiles/search.protobuf?defaults=true | time=83ms
INFO: Load quality profiles (done) | time=294ms
INFO: Load active rules
DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=cs-sonar-way-37148&p=1&ps=500 | time=43ms
DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=java-sonar-way-46287&p=1&ps=500 | time=36ms
DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=js-sonar-way-89672&p=1&ps=500 | time=39ms
DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=objectivec-oclint-09271&p=1&ps=500 | time=48ms
INFO: Load active rules (done) | time=758ms
INFO: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
INFO: Publish mode
DEBUG: Start recursive analysis of project modules
INFO: ------------- Scan OCDemo
INFO: Language is forced to objectivec
INFO: Load server rules
DEBUG: GET 200 http://localhost:9000/api/rules/list.protobuf | time=361ms
INFO: Load server rules (done) | time=474ms
DEBUG: Initializers :
INFO: Base dir: /Users/vikas/Documents/projects/demo
INFO: Working dir: /Users/vikas/Documents/projects/demo/.sonar
INFO: Source paths: .
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Index files
DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : **/*.cs
DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
DEBUG: Declared extensions of language Objective-C (Community) were converted to sonar.lang.patterns.objectivec : **/*.h,**/*.m
DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js
DEBUG: Language of file 'demo/AppDelegate.h' is detected to be 'objectivec'
DEBUG: Language of file 'demo/AppDelegate.m' is detected to be 'objectivec'
DEBUG: Language of file 'demo/main.m' is detected to be 'objectivec'
DEBUG: Language of file 'demo/ViewController.m' is detected to be 'objectivec'
DEBUG: Language of file 'demo/ViewController.h' is detected to be 'objectivec'
DEBUG: Language of file 'demoTests/demoTests.m' is detected to be 'objectivec'
INFO: 6 files indexed
INFO: Quality profile for objectivec: OCLint
INFO: JaCoCoSensor: JaCoCo report not found : /Users/vikas/Documents/projects/demo/target/jacoco.exec
INFO: JaCoCoItSensor: JaCoCo IT report not found: /Users/vikas/Documents/projects/demo/target/jacoco-it.exec
DEBUG: Code colorizer, supported languages: cs,objectivec
DEBUG: Sensors : Lines Sensor (wrapped) -> QProfileSensor -> Objective-C Squid Sensor -> SCM Sensor (wrapped) -> Code Colorizer Sensor (wrapped) -> CPD Sensor (wrapped)
INFO: Sensor Lines Sensor (wrapped)
INFO: Sensor Lines Sensor (wrapped) (done) | time=121ms
INFO: Sensor QProfileSensor
INFO: Sensor QProfileSensor (done) | time=5ms
INFO: Sensor Objective-C Squid Sensor
DEBUG: Metric lines is an internal metric computed by SonarQube. Provided value is ignored.
DEBUG: Metric lines is an internal metric computed by SonarQube. Provided value is ignored.
DEBUG: Metric lines is an internal metric computed by SonarQube. Provided value is ignored.
DEBUG: Metric lines is an internal metric computed by SonarQube. Provided value is ignored.
DEBUG: Metric lines is an internal metric computed by SonarQube. Provided value is ignored.
DEBUG: Metric lines is an internal metric computed by SonarQube. Provided value is ignored.
INFO: Sensor Objective-C Squid Sensor (done) | time=256ms
INFO: Sensor SCM Sensor (wrapped)
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
INFO: Sensor SCM Sensor (wrapped) (done) | time=0ms
INFO: Sensor Code Colorizer Sensor (wrapped)
INFO: Sensor Code Colorizer Sensor (wrapped) (done) | time=232ms
INFO: Sensor CPD Sensor (wrapped)
INFO: DefaultCpdIndexer is used for objectivec
DEBUG: Populating index from [moduleKey=OCD1, relative=demo/AppDelegate.h, basedir=/Users/vikas/Documents/projects/demo]
DEBUG: Populating index from [moduleKey=OCD1, relative=demo/AppDelegate.m, basedir=/Users/vikas/Documents/projects/demo]
DEBUG: Populating index from [moduleKey=OCD1, relative=demo/ViewController.h, basedir=/Users/vikas/Documents/projects/demo]
DEBUG: Populating index from [moduleKey=OCD1, relative=demo/ViewController.m, basedir=/Users/vikas/Documents/projects/demo]
DEBUG: Populating index from [moduleKey=OCD1, relative=demo/main.m, basedir=/Users/vikas/Documents/projects/demo]
DEBUG: Populating index from [moduleKey=OCD1, relative=demoTests/demoTests.m, basedir=/Users/vikas/Documents/projects/demo]
INFO: Sensor CPD Sensor (wrapped) (done) | time=29ms
DEBUG: Detection of duplications for OCD1:demo/ViewController.m
DEBUG: Detection of duplications for OCD1:demo/AppDelegate.m
DEBUG: Detection of duplications for OCD1:demoTests/demoTests.m
INFO: Analysis report generated in 70ms, dir size=11 KB
INFO: Analysis reports compressed in 54ms, zip size=10 KB
DEBUG: Upload report
DEBUG: POST 200 http://localhost:9000/api/ce/submit?projectKey=OCD1&projectName=OCDemo | time=416ms
INFO: Analysis report uploaded in 436ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/OCD1
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=AVR6giSDVdsGRifC8N_i
DEBUG: Report metadata written to /Users/vikas/Documents/projects/demo/.sonar/report-task.txt
DEBUG: Post-jobs :
INFO: Analysis report generated in /Users/vikas/Documents/projects/demo/.sonar/batch-report
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 14.414s
INFO: Final Memory: 41M/134M
INFO: ------------------------------------------------------------------------
DEBUG: Execution getVersion
DEBUG: Execution stop
+ returnValue=0
+ set +x
I got the solution.This issues because of older version of OCLint. I download the latest one from git fork. Along with this I Set the Parent of Profile Oclit-> Objective-C and it start working.

Install Apache from Puppetlabs on Vagrant

I'm new to this and I think I'm just missing one thing to grasp what the problem really is.
I understand that I can create my own puppet modules that will install certain packpages to a vagrant instance. There are also some ready-made ones, like this apache. I've run
vagrant ssh and installed it using puppet module install puppetlabs/apache. It now resides under /etc/puppet/modules/apache. But, the apache is not installed.
So, how do I install apache?
In my Vagrantfile I have
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.module_path = "puppet/modules"
puppet.manifest_file = "init.pp"
puppet.options="--verbose --debug"
end
Plus, in the main vagrant directory, under puppet/modules/apache/manifests/init.pp:
class apache2::install {
package { 'apache2':
ensure => present,
}
}
and yet, after vagrant provision or vagrant reload no apache is being installed, or what I guess, the installation process doesn't even start.
Log from after the vagrant provision, whose messages look totally cryptic to me.
[default] Running provisioner: puppet...
Running Puppet with init.pp...
debug: Creating default schedules
debug: Puppet::Type::User::ProviderDirectoryservice: file /usr/bin/dscl does not exist
debug: Puppet::Type::User::ProviderUser_role_add: file rolemod does not exist
debug: Puppet::Type::User::ProviderLdap: true value when expecting false
debug: Puppet::Type::User::ProviderPw: file pw does not exist
debug: Failed to load library 'ldap' for feature 'ldap'
debug: /File[/var/lib/puppet/ssl/certificate_requests]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state/graphs]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/facts]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/client_yaml]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/last_run_report.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/client_data]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/lib]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
debug: /File[/var/lib/puppet/state/last_run_summary.yaml]: Autorequiring File[/var/lib/puppet/state]
debug: /File[/var/lib/puppet/state]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/clientbucket]: Autorequiring File[/var/lib/puppet]
debug: /File[/var/lib/puppet/ssl]: Autorequiring File[/var/lib/puppet]
debug: Finishing transaction 70208664910260
debug: Loaded state in 0.00 seconds
debug: Loaded state in 0.00 seconds
info: Applying configuration version '1389652562'
debug: /Schedule[daily]: Skipping device resources because running on a host
debug: /Schedule[monthly]: Skipping device resources because running on a host
debug: /Schedule[hourly]: Skipping device resources because running on a host
debug: /Schedule[never]: Skipping device resources because running on a host
debug: /Schedule[weekly]: Skipping device resources because running on a host
debug: /Schedule[puppet]: Skipping device resources because running on a host
debug: Finishing transaction 70208665347780
debug: Storing state
debug: Stored state in 0.00 seconds
notice: Finished catalog run in 0.05 seconds
debug: Finishing transaction 70208665012580
debug: Received report to process from localhost.localdomain
debug: Processing report from localhost.localdomain with processor Puppet::Reports::Store
You've told Vagrant that it should look for manifests in puppet/manifests (relative to your Vagrant directory), and that it should configure the machine based on whatever is in init.pp, which it will look for in puppet/manifests (as per your instructions). That is, Vagrant will install whatever is in puppet/manifests/init.pp. It will not look at puppet/modules/apache/manifests/init.pp (at least, not at first).
Put something like the following in puppet/manifests/init.pp and it should install properly.
class {'apache':}
In addition to the apache module, make sure you have all dependancies (the stdlib and concat modules from Puppetlabs in this case) installed in your puppet/modules directory, too.
I went with a solution I don't fully like, as it overwrites any settings not provisioned by puppet. But hey, it gets the job done smoothly.
My Vagrantfile:
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "base"
#config.vm.box_url = "http://domain.com/path/to/above.box"
config.vm.network :forwarded_port, guest: 80, host: 5656, auto_correct: true
config.vm.provision :shell do |shell|
shell.inline = "mkdir -p /etc/puppet/modules;
puppet module install puppetlabs-concat --force --modulepath '/vagrant/puppet/modules'
puppet module install puppetlabs-stdlib --force --modulepath '/vagrant/puppet/modules'
puppet module install puppetlabs-apache --force --modulepath '/vagrant/puppet/modules'"
end
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.module_path = "puppet/modules"
puppet.manifest_file = "init.pp"
puppet.options="--verbose --debug"
end
end
Note: the script may actually also work without --force --modulepath '/vagrant/puppet/modules
My puppet/manifests/init.pp
node default {
class { 'apache': }
}
Thanks to https://stackoverflow.com/a/21105703/2066118 for pointing me into the right direction.
I'm not sure about Vagrant, but in puppet you need to mention what needed to install in a node on '/etc/puppet/manifests/site.pp' file.
So it will be like this.
node 'hosts.fqdn' {
include apache2
}
For more information : http://docs.puppetlabs.com/puppet/2.7/reference/lang_node_definitions.html

Unable to execute command on server using j2ssh

I connected to a unix server through ssh and tried to execute a "ls" command and obtain it's output. The code is like this
SessionChannelClient session = client.openSessionChannel();
session.startShell();
String cmd = "ls -l";
session.executeCommand(cmd);
ChannelInputStream in = session.getInputStream();
ChannelOutputStream out = session.getOutputStream();
IOStreamConnector input = new IOStreamConnector(System.in, session.getOutputStream());
IOStreamConnector output = new IOStreamConnector(session.getInputStream(), System.out);
After running I was not getting any output in log file. What I found is that the channel request is failing as shown
1019 [main] INFO com.sshtools.j2ssh.connection.ConnectionProtocol - Channel request succeeded
1020 [main] INFO com.sshtools.j2ssh.session.SessionChannelClient - Requesting command execution
1021 [main] INFO com.sshtools.j2ssh.session.SessionChannelClient - Command is ls -l
1021 [main] INFO com.sshtools.j2ssh.connection.ConnectionProtocol - Sending exec request for the session channel
1021 [main] INFO com.sshtools.j2ssh.transport.TransportProtocolCommon - Sending SSH_MSG_CHANNEL_REQUEST
1021 [main] INFO com.sshtools.j2ssh.connection.ConnectionProtocol - Waiting for channel request reply
1032 [Transport protocol 1] INFO com.sshtools.j2ssh.transport.TransportProtocolCommon - Received SSH_MSG_CHANNEL_EXTENDED_DATA
1033 [ssh-connection 1] DEBUG com.sshtools.j2ssh.transport.Service - Routing SSH_MSG_CHANNEL_EXTENDED_DATA
1033 [ssh-connection 1] DEBUG com.sshtools.j2ssh.transport.Service - Finished processing SSH_MSG_CHANNEL_EXTENDED_DATA
1075 [Transport protocol 1] INFO com.sshtools.j2ssh.transport.TransportProtocolCommon - Received SSH_MSG_CHANNEL_FAILURE
1075 [main] INFO com.sshtools.j2ssh.connection.ConnectionProtocol - Channel request failed
Why is this happening ?
You can use startShell or executeCommand, but not both.
executeCommand is only intended to invoke a particular shell of your choosing, e.g. /bin/bash. In most cases you can just use startShell to start the default shell.
This is all you need to execute the command you provided:
final String cmd = "ls -l" + '\n';
session.startShell();
session.getOutputStream().write(cmd.getBytes());
Or, alternatively, using executeCommand:
final String cmd = "ls -l";
session.executeCommand(String.format("sh -c \"%s\"", cmd));
You can hook up to the stdout & stderr InputStreams in the same manner to see the result of your command. Further, note that a SessionChannelClient can only process one command. You'll need to instantiate another one to send a second command.
I suggest you download the J2SSH documentation. Inside you'll find j2ssh-getting-started.htm which explains the basic operation of the API.