【问题标题】:What is the "vagrant-host-manager start id" in the /etc/hosts file?/etc/hosts 文件中的“vagrant-host-manager start id”是什么?
【发布时间】:2015-06-03 00:57:56
【问题描述】:

我在一个项目中使用 Vagrant(1.7.2)、VirtualBox(4.3.26) 和 puphpet。我正在使用 vagrant 插件vagrant-host-manager 以编程方式写入vagrant upvagrant halt 上的/etc/hosts 文件。

我注意到插件在 /etc/hosts 的 cmets 中提供了信息

## vagrant-hostmanager-start id: 26c12a6f-22fd-4053-g193-77707p90318(经过混淆的 id)

我认为 id 字符串可能会包含我正在运行的虚拟机的名称,因为它会出现在 VirtualBox GUI 中。情况似乎并非如此。我想知道如何将上述 id 与我的几台机器相关联。

我想知道这一点,因为我有几个虚拟机包含相同的 IP 地址和一组主机名,因此我无法轻易辨别哪个虚拟机写了什么。

【问题讨论】:

  • 我也在努力寻找这个确切问题的答案。

标签: vagrant virtualbox hosts puphpet vagrant-plugin


【解决方案1】:

我也在找,ID是https://github.com/devopsgroup-io/vagrant-hostmanager/blob/2b75b7f00f4b929023c7d6e3cd70d75b334c560b/lib/vagrant-hostmanager/hosts_file/updater.rb#L166写到hosts文件的。

#{@global_env.local_data_path}/hostmanager/id读取信息,如果该文件不存在,则通过调用SecureRandom.uuid生成一个新ID

基本上,如果您需要知道 ID,只需从相对于您的 Vagrantfile 的 .vagrant/hostmanager/id 文件中读取它即可

【讨论】:

    猜你喜欢
    • 2018-07-16
    • 1970-01-01
    • 2015-02-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-04
    • 1970-01-01
    相关资源
    最近更新 更多