Giter Club home page Giter Club logo

chef-expect's Introduction

Expect Cookbook

Chef cookbook Build Status

Description

This cookbook will install Expect package.

Expect is a tool for automating interactive applications such as telnet, ftp, passwd, fsck, rlogin, tip, etc. Expect really makes this stuff trivial. Expect is also useful for testing these same applications. And by adding Tk, you can also wrap interactive applications in X11 GUIs. Expect can make easy all sorts of tasks that are prohibitively difficult with anything else. You will find that Expect is an absolutely invaluable tool - using it, you will be able to automate tasks that you've never even thought of before - and you'll be able to do this automation quickly and easily.

Expect requires Tcl (tool command language). This cookbook will provide Tcl package if necessary (currently only Windows platform requires it).

Platforms

  • Ubuntu
  • CentOS
  • RedHat
  • Fedora
  • Mac OS X
  • Windows

Chef

  • Chef 12 or later

Attributes

expect::default

Key Type Description Platform Default
default['expect']['include_homebrew'] Boolean Include homebrew recipe for installing brew on Mac OS Mac OS true
default['expect']['cygwin']['from_system'] Boolean Use the Cygwin from system Windows false
default['expect']['cygwin']['home'] String Installation path for the Cygwin Windows 'C:\\cygwin'
default['expect']['cygwin']['site'] String Server where the Cygwin should search for the packages Windows 'http://cygwin.mirrors.pair.com'

Recipes

expect::default

Installs Expect package on node and if the node platform is Windows then the recipe also installs Cygwin component.

Usage - expect::default

Just include expect in your node's run_list:

{
  "name":"my_node",
  "run_list": [
    "recipe[expect]"
  ]
}

Resources

This cookbook provides a script provider called expect_script which will execute expect script using Tcl according to current OS.

Property Type Description Default Required
cwd String The current working directory true false
code String A quoted string of code to be executed false true
environment Hash A Hash of environment variables in the form of ({"ENV_VARIABLE" => "VALUE"}) 'C:\\cygwin' false
user [String, Integer] The user name or user ID that should be changed before running a command nil false
group [String, Integer] The group name or group ID that must be changed before running a command nil false

Usage expect_script

expect_script 'Example expect script with system command' do
  code <<-EOH
    spawn ftp
    set timeout 30
    expect {
      -regexp "ftp.*" {
        exp_send "bye\r"
        exp_continue
      }
      eof
    }
  EOH
end
expect_script 'Example expect script with bash script' do
  cwd '/'
  environment 'PATH' => "#{ENV['PATH']}:/tmp/test"
  code <<-EOH
    spawn test.sh
    set timeout 30
    expect {
      -regexp "Would you like to delete your all files (yes/no)?.*" {
        exp_send "no\r"
        exp_continue
      }
      eof
    }
  EOH
  user 'root'
  group 'root'
end

Contributing

License and Authors

Authors: Radoslaw Jaros

chef-expect's People

Contributors

brantone avatar rjaros87 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.