我正在使用puppet来配置一个vagrant(基于ubuntu的)虚拟机.在我的脚本中,我需要:
sudo apt-get build-dep python-lxml
Run Code Online (Sandbox Code Playgroud)
我知道我可以安装apt puppet模块,所以我可以使用:
apt::builddep { 'python-lxml': }
Run Code Online (Sandbox Code Playgroud)
但我找不到任何关于从脚本安装模块以及如何包含/要求它的参考.在我看来,木偶文档仅指从命令行木偶工具安装
我也尝试过这样的事情:
define build_dep($pkgname){
exec {
"builddepend_$pkgname":
commmand => "sudo apt-get build-dep $pkgname";
}
}
build_dep{
"python-imaging":
pkgname => "python-imaging";
"python-lxml":
pkgname => "python-lxml";
}
Run Code Online (Sandbox Code Playgroud)
但是傀儡退出了这个错误.并且:
exec{"install apt module":
command => "puppet module install puppetlabs/apt"
}
class { 'apt':
require => Exec["install apt module"]}
include apt
apt::builddep { 'python-imaging':
}
Run Code Online (Sandbox Code Playgroud)
但得到了 could not find declared class apt at..
有任何想法吗?方向?我知道我错过了一些明显但却无法解决的问题.
编辑:如果我预先安装(puppet module install从命令行),apt:builddep …
我有这条QML代码:
Column {
spacing: units.gu(2)
anchors {
fill: parent
centerIn: parent
}
Row {
spacing: units.gu(4)
...
}
Row {
spacing: units.gu(4)
...
}
Row {
spacing: units.gu(4)
...
}
Row {
spacing: units.gu(4)
...
}
}
Run Code Online (Sandbox Code Playgroud)
关于QML编程的最佳实践,如何重用代码以避免常见元素的重复属性?例如,在上面的示例中,避免行"spacing:units.gu(4)".
我有这条QML代码:
Column {
spacing: units.gu(2)
anchors {
fill: parent
centerIn: parent
}
Row {
spacing: units.gu(4)
...
}
Row {
spacing: units.gu(4)
...
}
Row {
spacing: units.gu(4)
...
}
Row {
spacing: units.gu(4)
...
}
}
Run Code Online (Sandbox Code Playgroud)
我试图将Column置于其父元素(Page元素)中,但它不起作用.如果尝试centerIn: parent在其中一行中,它可以工作,但由于我有4行,它会打破布局.但是Rows回应了这个,而不是我的专栏.
为什么要centerIn: parent为Column工作?还有另一种方法可以集中体现吗?