~asanjar/charms/trusty/hdp-hadoop/trunk

« back to all changes in this revision

Viewing changes to hooks/tests.py

  • Committer: amir sanjar
  • Date: 2014-07-09 12:37:36 UTC
  • Revision ID: amir.sanjar@canonical.com-20140709123736-47dtob34h9z3a47y
Initila HortonWorks Hadoop Charm

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
import os
 
3
import sys
 
4
import tarfile
 
5
import subprocess
 
6
 
 
7
def wgetPkg(pkgName, crypType):
 
8
    pkgName
 
9
    crypFileName= pkgName+'.'+crypType    
 
10
    cmd = 'wget '+pkgName
 
11
    subprocess.call(cmd.split())
 
12
    if crypType:
 
13
        cmd = ['wget', crypFileName]
 
14
        subprocess.call(cmd)
 
15
 
 
16
home  = os.path.join(os.path.sep, "home", "sanjar") 
 
17
hdpScript = "hdp_scripts"
 
18
hdpScriptPath = os.path.join(os.path.sep,home, hdpScript)
 
19
os.chdir(home); os.mkdir(hdpScript) ; os.chdir(hdpScript)
 
20
tarfilename="hdp_manual_install_rpm_helper_files-2.1.1.385.tar.gz"
 
21
wgetPkg("http://public-repo-1.hortonworks.com/HDP/tools/2.1.1.0/hdp_manual_install_rpm_helper_files-2.1.1.385.tar.gz","")
 
22
if tarfile.is_tarfile(tarfilename):
 
23
        tball = tarfile.open(tarfilename)
 
24
        tball.extractall(hdpScriptPath)
 
25
else:
 
26
        print ("Unable to extract Hadoop Tarball ")
 
27