           for filename in #{Object.keys(options.etc_default).join(' ')}; do
             source="/etc/default/$filename"
             target="/usr/hdp/$version/etc/default/$filename"
-
             if [ ! -f $target ]; then
               if [ $source == "/etc/default/#{options.name}" ]; then continue; else exit 1; fi
             fi


module.exports = (ctx) ->
  # Options include
  # startup: [true] or false
  # link: [true]
  # write: array
  # version_name
  ctx.hdp_service = (options, callback) ->
    options = name: options if typeof options is 'string'
    wrap null, arguments, (options, callback) ->
      # options = name: options if typeof options is 'string'
      # options = [options] unless Array.isArray options
      changed = false
      # each options
      # .run (options, next) ->
      options.startup ?= false
      # options.link ?= true
      options.version_name ?= options.name
      return callback Error "Missing Option 'name'" unless options.name
      version=''

          if [ "#{options.version}" == "latest" ]; then
            version=`hdp-select versions | tail -1`
          elif [ "#{options.version}" == "current" ]; then
            version=`hdp-select status #{options.version_name} | sed 's/.* \\(.*\\)/\\1/'`
          else
            version='#{options.version}'
          fi
          if [ ! -d "/usr/hdp/$version" ]; then
            echo 'Failed to detect the latest HDP version'
            exit 1
          fi
          echo $version
          hdp-select set #{options.version_name} $version
