Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #9568: Add id autodetection in vagrantfile #84

Conversation

peckpeck
Copy link
Member

@peckpeck
Copy link
Member Author

ping @amousset

@@ -90,15 +120,15 @@ def configure(config, os, pf_name, pf_id, host_name, host_id,

# provisioning script
if os == $windows7 or os == $windows2008 then
command = "c:/vagrant/scripts/network.cmd #{net} #{host_list}\n"
command = "c:/vagrant/scripts/network.cmd #{net} @host_list@\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the @ mean ? I did'nt find anything relatd in ruby ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing, it is a marker
The goal is to avoid interpreting this variable now because it is not yes full.
It is interpreted at the bottom of the script with a sub function

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok ! saw it! command.sub("@host_list@", host_list)

It's confusing with the host_list variable passed as parameter

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it could be called host_list_to_replace

}
$last_pf_id = 0

def configure_box(config, os, pf_name, host_name,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this function called elsewhere ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, it is meant to be called from the varantfile

windows_plugin:false, advanced_reporting:false,
ncf_version:nil, cfengine_version:nil, ram:nil
)
pf = $platforms.fetch(pf_name) { |key|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As i understand the goal is to replace all calls to configure to configure_box in vagrantfile in another pull request ?

But, unless you start all platforms, the platforms variable will always start from scratch and so have id 0 for all platform ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not, the vagrantfile is considered to be a configuration file and not just a script. So it is fully evaluated before launching ant VM

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means you need to have only configure_box call in your vagrantfile, if you have a mixed state it won't work ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we need something to migrate

@Normation-Quality-Assistant

OK, merging this PR

@Normation-Quality-Assistant Normation-Quality-Assistant merged commit a575a4f into Normation:master Jan 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants