jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Everett Toews (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (JCLOUDS-446) Script doesn't run
Date Sun, 02 Feb 2014 21:14:09 GMT

    [ https://issues.apache.org/jira/browse/JCLOUDS-446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13889058#comment-13889058
] 

Everett Toews commented on JCLOUDS-446:
---------------------------------------

I'm running into a similar problem just trying to update an Ubuntu VM with {{sudo apt-get
-q -y update}}. The ssh session ends before the command can complete. At first I thought it
was an sshj issue but I ran the following code successfully using sshj 0.8.1

{code}
import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.common.IOUtils;
import net.schmizz.sshj.connection.channel.direct.Session;
import net.schmizz.sshj.connection.channel.direct.Session.Command;
import net.schmizz.sshj.transport.verification.HostKeyVerifier;

import java.io.IOException;
import java.security.PublicKey;
import java.util.concurrent.TimeUnit;

/**
 * This examples demonstrates how a remote command can be executed.
 */
public class Exec {
    public static void main(String... args) throws IOException {
        final SSHClient ssh = new SSHClient();
        ssh.addHostKeyVerifier(
                new HostKeyVerifier() {
                    public boolean verify(String arg0, int arg1, PublicKey arg2) {
                        return true;  // example code only. never do this.
                    }
                }
        );

        try {
            ssh.connect("23.253.94.78");
            ssh.authPassword("root", "SVxApPj4c8Ux");
            final Session session = ssh.startSession();

            try {
                final Command cmd = session.exec("sudo apt-get -q -y update");

                System.out.println("stdout\n" + IOUtils.readFully(cmd.getInputStream()).toString());

                cmd.join(60, TimeUnit.SECONDS);

                System.out.println("\n** exit status: " + cmd.getExitStatus());
            } finally {
                session.close();
            }
        } finally {
            ssh.disconnect();
        }
    }
}
{code}

This runs happily so it seems that it's something that jclouds is doing (or not doing).

> Script doesn't run 
> -------------------
>
>                 Key: JCLOUDS-446
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-446
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-compute
>    Affects Versions: 1.7.0, 1.8.0
>            Reporter: Izek Greenfield
>
> Hi,
> i have this script: 
> `rm -rf /etc/puppet/prodpuppet
>         cd /etc/puppet
>         git clone http://10.234.0.72/prodpuppet /etc/puppet/prodpuppet
>         for file in `find /etc/puppet/prodpuppet -iname *.sh`
>         do
>           chmod 700 $file
>         done
>         rm -rf /etc/puppet/chpuppet
>         git clone http://10.234.0.72/chpuppet /etc/puppet/chpuppet
>         for file in `find /etc/puppet/chpuppet -iname *.sh`
>         do
>           chmod 700 $file
>         done
>         cd -
>         echo '
>         class role::scopeBase {
>                require bin_repo::client
>                #require sysstat
>                require set_env
>                #require expect
>                require admin::ssh_disable_host_key_check
>                require admin::augeas
>                require admin::log
>                require admin::ntp
>                require admin::yum
>         }
>                     class role::scope inherits role::scopeBase {
>                           #####################
>                           # hostname izek-as-mongo0
>                           #####################
>         include mongodb_tar
>         include emm
>         }' > /etc/puppet/chpuppet/modules/role/manifests/scope.pp
>         echo '{"rpm::folder":"/opt/nds/rpms","mongodb_tar::version":"2.4.5.1","bin_repo::url":"http://10.234.0.72/dependencies","bin_repo::host":"10.234.0.72","emm::version":"3.51.0-2","bin_repo::dir":"/opt/nds/rpms","install_dir":"/opt/nds/installed/","bin_repo::components::url":"http://10.234.0.72/components"}'
> /etc/puppet/chpuppet/hieradata/role/scope.json
>         chmod 600 /etc/puppet/chpuppet/hieradata/role/scope.json
>         augtool set /files/etc/puppet/puppet.conf/main/environment scope
>         augtool set /files/etc/puppet/puppet.conf/main/modulepath /etc/puppet/modules:/usr/share/puppet/modules:/etc/puppet/prodpuppet/modules:/etc/puppet/chpuppet/modules:/etc/puppet/chpuppet/forge
>         ln -s /etc/puppet/chpuppet/hieradata/hiera.yaml /etc/puppet/hiera.yaml
>         ln -s /etc/puppet/chpuppet/hieradata /etc/hieradata
>         cd /etc/puppet
>         export FACTER_vmrole=scope; export FACTER_fqdn=com; /etc/puppet/chpuppet/provisioning/puppet/puppet_check.sh
role::scope
>         cd -`
> when running from java the git clone do nothing. when log into the machine and run the
script it is OK.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message