summaryrefslogtreecommitdiffstats
path: root/ipapython/py_default_encoding
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-12-02 11:05:54 -0500
committerAdam Young <ayoung@redhat.com>2010-12-03 13:01:42 -0500
commit8a63315ef30ac1a8fdab1394601cd588a105f66d (patch)
treeb6b149ee062c3c3ffcfc9e1246ce7ac03f86ca9e /ipapython/py_default_encoding
parent867ac1f03d77d72b25037ddf7cacccf407ff531e (diff)
Provide list of available attributes for use in ACI UI.
Also include flag indicating whether the object is bindable. This will be used to determine if the object can have a selfservice ACI. ticket 446
Diffstat (limited to 'ipapython/py_default_encoding')
0 files changed, 0 insertions, 0 deletions
n133'>133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
#!/bin/bash

###############################################################################
# TODO: Support other OSes.                                                   #
###############################################################################

ORIGIN_DIR=$PWD
autostart="no"
destroy_after_test="no"
os="fedora"
destroy_now="no"
run_tests_args=""
redirect=">/dev/null 2>&1"
ssh="no"
custom_cflags=""


pushd () {
    command pushd "$@" >/dev/null
}

popd () {
    command popd "$@" >/dev/null
}

function parse_args () {
    args=`getopt \
              --options a \
              --long autostart,os:,destroy-now,destroy-after-test,verbose,ssh \
              -n 'run-tests-in-vagrant.sh' \
              --  "$@"`
    eval set -- "$args"
    while true; do
        case "$1" in
            -a|--autostart) autostart="yes"; shift ;;
            --destroy-after-test) destroy_after_test="yes"; shift ;;
            --destroy-now)  destroy_now="yes"; shift ;;
            --ssh)  sshvm="yes"; shift ;;
            --os)
                case "$2" in
                    "") shift 2 ;;
                     *) os="$2" ; shift 2 ;;
                esac ;;
            --verbose)  redirect=""; shift ;;
            --) shift ; break ;;
            *) echo "Internal error!" ; exit 1;;
        esac
    done
    run_tests_args="$@"
}

function force_location()
{
    current_dir=$(dirname $0);

    if [ ! -f ${current_dir}/tests/vagrant/vagrant-template-fedora/Vagrantfile ]; then
        echo "Aborting."
        echo "The tests/vagrant subdirectory seems to be missing."
        echo "Please correct the problem and try again."
        exit 1
    fi
}

function vagrant_check()
{
    vagrant -v >/dev/null  2>&1;

    if [ $? -ne 0 ]; then
        echo "Aborting"
        echo "Vagrant not found. Please install Vagrant and try again."
        echo "On Fedora, run "dnf install vagrant vagrant-libvirt" "
        exit 1
    fi
}

function ansible_check()
{
    ansible --version  >/dev/null  2>&1 ;

    if [ $? -ne 0 ]; then
        echo "Aborting"
        echo "Ansible not found. Please install Ansible and try again."
        echo "On Fedora, run "dnf install ansible" "
        exit 1
    fi
}

function set_branchname_from_git_branch()
{
    BRANCHNAME=`git rev-parse --abbrev-ref HEAD`
    if [ $? -ne 0 ]; then
        echo "Could not get branch name from git, will exit"
        exit 1
    fi
}


function destroy_vm_and_exit()
{
    echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!CAUTION!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
    echo "This will destroy VM and delete tests/vagrant/${BRANCHNAME} dir"
    echo
    while true; do
        read -p "Do you want to continue?" yn
        case $yn in
            [Yy]* ) break;;
            * ) echo "Did not get an yes, exiting."; exit 1 ;;
        esac
    done
    if [ -d "tests/vagrant/${BRANCHNAME}" ]; then
        pushd "tests/vagrant/${BRANCHNAME}"
        eval vagrant destroy $redirect
        popd
        rm -rf "tests/vagrant/${BRANCHNAME}"
        exit 0
    else
        echo "Could not find vagrant dir for corresponding git branch, exiting"
        exit 1
    fi
}


function create_vagrant_dir()
{
    mkdir -p tests/vagrant/$BRANCHNAME
    if [ -d "tests/vagrant/vagrant-template-${os}" ]; then
        echo "Copying tests/vagrant/vagrant-template-${os} dir to tests/vagrant/${BRANCHNAME} ...."
        cp -R tests/vagrant/vagrant-template-${os}/* tests/vagrant/$BRANCHNAME
    else
        echo "Could not find template files for requested os $os, exiting"
        exit 1
    fi
}


function start_vm()
{
    echo "Doing vagrant up...."
    pushd "tests/vagrant/${BRANCHNAME}"
    eval vagrant up $redirect
    if [ $? -eq 0 ]
    then
            popd
    else
            echo "Vagrant up failed, exiting....";
            popd
            exit 1
    fi
}

function set_vm_attributes()
{
    if [ "x$autostart" == "xyes" ] ; then
        virsh autostart ${BRANCHNAME}_vagrant-testVM
    fi
}

function copy_source_code()
{
    echo "Copying source code from host machine to VM...."
    pushd "tests/vagrant/${BRANCHNAME}"
    vagrant ssh-config > ssh_config
    rsync -az -e "ssh -F ssh_config" --rsync-path="sudo rsync" "$ORIGIN_DIR/." vagrant-testVM:/home/vagrant/glusterfs
    if [ $? -eq 0 ]
    then
            popd
    else
            echo "Copy failed, exiting...."
            popd
            exit 1
    fi
}

function compile_gluster()
{