diff --git a/files/Sauce-Connect.jar b/files/Sauce-Connect.jar deleted file mode 100644 index 4a3f7a5..0000000 Binary files a/files/Sauce-Connect.jar and /dev/null differ diff --git a/files/etc_default_sauce-connect b/files/etc_default_sauce-connect deleted file mode 100644 index 9a9da2f..0000000 --- a/files/etc_default_sauce-connect +++ /dev/null @@ -1,20 +0,0 @@ -# You must define: -# $JAVA: absolute path to java bin -# $SAUCE_CONNECT: absolute path to sauce connect .jar -# $API_USER: your username at SauceLabs -# $API_KEY: your API KEY for this username -# $USERNAME: Use this username to run SauceConnect -# $GROUP: Use this group to run SauceConnect -# $LOG_DIR: directory to put log files. Be aware $USERNAME:$GROUP must have -# permission to write there, if not it will die silently at start -# -# You can also override any variable used in /etc/init.d/sauce-connect too, if -# you know what you are doing. For example, you can override $PIDFILE. - -JAVA=/usr/lib/jvm/java-6-openjdk/jre/bin/java -SAUCE_CONNECT=/usr/share/sauce/Sauce-Connect.jar -API_USER= -API_KEY= -USERNAME= -GROUP= -LOG_DIR=/var/log/sauce diff --git a/files/init.d_sauce-connect b/files/init.d_sauce-connect index 5407423..3d028e8 100644 --- a/files/init.d_sauce-connect +++ b/files/init.d_sauce-connect @@ -29,9 +29,8 @@ DAEMON="" # You must configure there your API KEY too [ -r /etc/default/$NAME ] && . /etc/default/$NAME -DAEMON="$JAVA" -DAEMON_ARGS=" -jar $SAUCE_CONNECT $API_USER $API_KEY" - +DAEMON="$SAUCE_CONNECT" +DAEMON_ARGS="--logfile $LOG_FILE -u $API_USER -k $API_KEY" # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 @@ -53,11 +52,15 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started - start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ - || return 1 - start-stop-daemon -b -m -c $USERNAME:$GROUP --chdir $LOG_DIR --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + #start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + # || return 1 + + CUSER="" + [ -n "$USERNAME" ] && [ -n "$GROUP"] && CUSER="-c $USERNAME:$GROUP" + start-stop-daemon -b -m --chdir $LOG_DIR $CUSER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $DAEMON_ARGS \ || return 2 + sleep 10 # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend # on this one. As a last resort, sleep for some time. diff --git a/files/sc b/files/sc new file mode 100755 index 0000000..66fd444 Binary files /dev/null and b/files/sc differ diff --git a/manifests/daemon.pp b/manifests/daemon.pp index 9d614d2..d619812 100644 --- a/manifests/daemon.pp +++ b/manifests/daemon.pp @@ -8,13 +8,13 @@ class sauceconnect::daemon($username, $apikey) { '/etc/default/sauce-connect' : ensure => present, content => " -JAVA=/usr/lib/jvm/java-6-openjdk/jre/bin/java -SAUCE_CONNECT=/usr/share/sauce/Sauce-Connect.jar +SAUCE_CONNECT=/usr/share/sauce/sc API_USER=${username} API_KEY=${apikey} USERNAME= GROUP= LOG_DIR=${logdir} +LOG_FILE=${logdir}/sc.log "; '/etc/init.d/sauce-connect' : diff --git a/manifests/debian.pp b/manifests/debian.pp index 70ded25..3f6c6ee 100644 --- a/manifests/debian.pp +++ b/manifests/debian.pp @@ -1,6 +1,2 @@ class sauceconnect::debian { - package { - 'openjdk-6-jre' : - ensure => present; - } } diff --git a/manifests/init.pp b/manifests/init.pp index 6dd3bac..7cdd631 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,10 +5,10 @@ class sauceconnect($username="", $apikey="") { $dir : ensure => directory; - "$dir/Sauce-Connect.jar" : + "$dir/sc" : ensure => present, require => File[$dir], - source => 'puppet:///modules/sauceconnect/Sauce-Connect.jar'; + source => 'puppet:///modules/sauceconnect/sc'; } class { diff --git a/spec/classes/debian_spec.rb b/spec/classes/debian_spec.rb deleted file mode 100644 index fb30fff..0000000 --- a/spec/classes/debian_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'spec_helper' - -describe 'sauceconnect::debian' do - it 'should install the JRE' do - should contain_package('openjdk-6-jre').with({ - 'ensure' => 'present' - }) - end -end diff --git a/spec/classes/sauceconnect_spec.rb b/spec/classes/sauceconnect_spec.rb index 2b9b2c8..cd999a4 100644 --- a/spec/classes/sauceconnect_spec.rb +++ b/spec/classes/sauceconnect_spec.rb @@ -5,14 +5,14 @@ describe 'sauceconnect' do {:osfamily => 'debian'} end - it 'should create a directory for the jar file' do + it 'should create a directory for the sc binary' do should contain_file('/usr/share/sauce').with({ 'ensure' => 'directory' }) end - it 'should place the jar file' do - should contain_file('/usr/share/sauce/Sauce-Connect.jar').with({ + it 'should place the sc binary' do + should contain_file('/usr/share/sauce/sc').with({ 'ensure' => 'present', 'require' => 'File[/usr/share/sauce]' })