Развертывание в EC2 с использованием Rubber под Windows

Я пытаюсь развернуть приложение Rails в экземпляре Amazon EC2, но получаю ту же ошибку.

Trying to enable root login

c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rubber-2.8.0/lib/rubber/recipes/rubber/setup.rb:173:in `read': No such file or directory - /etc/hosts (Errno::ENOENT)

Эта ошибка указывает на этот блок в этом файле

desc <<-DESC
  Sets up local aliases for instance hostnames based on contents of instance.yml.
  Generates/etc/hosts for local machine
DESC
required_task :setup_local_aliases do
  hosts_file = '/etc/hosts'

  # Generate /etc/hosts contents for the local machine from instance config
  delim = "## rubber config #{rubber_env.domain} #{Rubber.env}"
  local_hosts = delim + "\n"
  rubber_instances.each do |ic|
    # don't add unqualified hostname in local hosts file since user may be
    # managing multiple domains with same aliases
    hosts_data = [ic.full_name, ic.external_host, ic.internal_host]

    # add the ip aliases for web tools hosts so we can map internal tools
    # to their own vhost to make proxying easier (rewriting url paths for
    # proxy is a real pain, e.g. '/graphite/' externally to '/' on the
    # graphite web app)
    if ic.role_names.include?('web_tools')
      Array(rubber_env.web_tools_proxies).each do |name, settings|
        hosts_data << "#{name}-#{ic.full_name}"
      end
    end

    local_hosts << ic.external_ip << ' ' << hosts_data.join(' ') << "\n"
  end
  local_hosts << delim << "\n"

  # Write out the hosts file for this machine, use sudo
  *LINE 173* existing = File.read(hosts_file)
  filtered = existing.gsub(/^#{delim}.*^#{delim}\n?/m, '')

  # only write out if it has changed
  if existing != (filtered + local_hosts)
    logger.info "Writing out aliases into local machines #{hosts_file}, sudo access needed"
    Rubber::Util::sudo_open(hosts_file, 'w') do |f|
      f.write(filtered)
      f.write(local_hosts)
    end
  end
end

Я добавил текст *LINE 173* к фактической строке ошибка ссылки.

Я нашел эту ветку группы Google об этом, но я не уверен, как изменить путь для Windows

https://groups.google.com/forum/

Любая помощь будет оценена. Я снова пытаюсь развернуть приложение Rails на экземпляре EC2 на компьютере с Windows 8.

1 ответ

Эквивалентный файл в Windows

C:\Windows\System32\drivers\etc\hosts

Этот код может иметь проблемы с записью в этот файл, поскольку он требует привилегированного доступа.

Другие вопросы по тегам