Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/proxmox_kvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def get_vminfo(module, proxmox, node, vmid, **kwargs):
kwargs = dict((k, v) for k, v in kwargs.items() if v is not None)

# Convert all dict in kwargs to elements. For hostpci[n], ide[n], net[n], numa[n], parallel[n], sata[n], scsi[n], serial[n], virtio[n]
for k in kwargs.keys():
for k in list(kwargs):
if isinstance(kwargs[k], dict):
kwargs.update(kwargs[k])
del kwargs[k]
Expand Down Expand Up @@ -730,7 +730,7 @@ def create_vm(module, proxmox, vmid, newid, node, name, memory, cpu, cores, sock
#kwargs['net'][n]['virtio'] = results['mac'][n]

# Convert all dict in kwargs to elements. For hostpci[n], ide[n], net[n], numa[n], parallel[n], sata[n], scsi[n], serial[n], virtio[n]
for k in kwargs.keys():
for k in list(kwargs):
if isinstance(kwargs[k], dict):
kwargs.update(kwargs[k])
del kwargs[k]
Expand Down
13 changes: 7 additions & 6 deletions nix/ansible/default.nix
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{ pkgs ? import <nixpkgs> {}
, windowsSupport ? false
, pythonPackages
}:

with pkgs;
with pythonPackages;

pythonPackages.buildPythonPackage rec {
buildPythonPackage rec {
pname = "ansible";
version = "devel";
name = "${pname}-${version}";

src = fetchFromGitHub {
src = pkgs.fetchFromGitHub {
owner = "ansible";
repo = "ansible";
rev = "1724b633f2fdc4c8d49e634d44864ef5e2e2d4c6";
Expand All @@ -28,10 +29,10 @@ pythonPackages.buildPythonPackage rec {
dontPatchShebangs = false;

propagatedBuildInputs = with pythonPackages; [
pycrypto paramiko jinja2 pyyaml httplib2 boto six netaddr dnspython
] ++ stdenv.lib.optional windowsSupport pywinrm;
pycrypto paramiko jinja2 pyyaml httplib2 boto six netaddr dnspython cryptography
] ++ pkgs.stdenv.lib.optional windowsSupport pywinrm;

meta = with stdenv.lib; {
meta = with pkgs.stdenv.lib; {
homepage = http://www.ansible.com;
description = "A simple automation tool";
license = with licenses; [ gpl3 ];
Expand Down
10 changes: 6 additions & 4 deletions nix/glob2/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> {}
, pythonPackages
}:

with pkgs;
with pythonPackages;

python27.pkgs.buildPythonPackage rec {
buildPythonPackage rec {
pname = "glob2";
version = "0.6";

src = python36.pkgs.fetchPypi {
src = fetchPypi {
inherit pname version;
sha256 = "1miyz0pjyji4gqrzl04xsxcylk3h2v9fvi7hsg221y11zy3adc7m";
};
Expand Down
12 changes: 7 additions & 5 deletions nix/proxmoxer/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
{ pkgs ? import <nixpkgs> {}
, pythonPackages
}:

python27.pkgs.buildPythonPackage rec {
with pythonPackages;

buildPythonPackage rec {
pname = "proxmoxer";
version = "1.0.3";

src = python36.pkgs.fetchPypi {
src = fetchPypi {
inherit pname version;
sha256 = "145hvphvlzvwq6sn31ldnin0ii50blsapxz0gv2zx3grzp6x9hvh";
};
Expand Down
16 changes: 9 additions & 7 deletions nix/pytest-bdd/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
{ pkgs ? import <nixpkgs> {} }:
{ pkgs ? import <nixpkgs> {}
, pythonPackages
}:

with pkgs;
with pythonPackages;

python27.pkgs.buildPythonPackage rec {
buildPythonPackage rec {
pname = "pytest-bdd";
version = "3.0.0";
version = "3.1.1";

src = python36.pkgs.fetchPypi {
src = fetchPypi {
inherit pname version;
sha256 = "1np2qvfnhz3amd02f2y4shp4pracnfdkcdxkhkigv997iwc4sih0";
sha256 = "0r5p9i0viqfm8l5336fpjjwad4z98077fgi3652qym75mmhirb2w";
};

glob2 = callPackage ../glob2 {};
glob2 = callPackage ../glob2 { inherit pythonPackages; };

nativeBuildInputs = with pythonPackages; [ setuptools_scm ];
propagatedBuildInputs = with pythonPackages; [ glob2 pytest pytest-forked mock pytest_xdist Mako parse-type ];
Expand Down
4 changes: 2 additions & 2 deletions plugins/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def dict_merge(dct, merge_dct):
:param merge_dct: dct merged into dct
:return: None
"""
for k, v in merge_dct.iteritems():
for k, v in merge_dct.items():
if (k in dct and isinstance(dct[k], dict)
and isinstance(merge_dct[k], collections.Mapping)):
dict_merge(dct[k], merge_dct[k])
Expand Down Expand Up @@ -115,7 +115,7 @@ def get_steps(node, steps_list):

def filter_dict(src, pred):
p = eval(pred)
return { k: v for k, v in src.iteritems() if p(v)}
return { k: v for k, v in src.items() if p(v)}

def format2(what, fmt):
return fmt % what
Expand Down
2 changes: 1 addition & 1 deletion roles/inventory/templates/ssh_config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% for node_name, node in stack.nodes.iteritems() %}
{% for node_name, node in stack.nodes.items() %}
Host {{node_name}}.{{stack.domain}} {{node_name}}
HostName {{node.net.eth0.ipv4[0]|ipaddr('address')}}
User root
Expand Down
2 changes: 1 addition & 1 deletion roles/inventory/templates/ssh_config-bootstrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% for node_name, node in stack.nodes.iteritems() %}
{% for node_name, node in stack.nodes.items() %}
Host {{node_name}}.{{stack.domain}} {{node_name}}
{% if node.nics is defined %}
HostName {{node.nics.eth0.addrs[0]|ipaddr('address')}}
Expand Down
12 changes: 6 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
with pkgs;

let
pytest-bdd = callPackage nix/pytest-bdd {};
proxmoxer = callPackage nix/proxmoxer {};
ansible = callPackage nix/ansible {};
myPytest-bdd = callPackage nix/pytest-bdd { pythonPackages = python37Packages; };
myProxmoxer = callPackage nix/proxmoxer { pythonPackages = python37Packages; };
myAnsible = callPackage nix/ansible { pythonPackages = python37Packages; };

myPython = python27.withPackages (ps: with ps; [ pytest-bdd proxmoxer jmespath virtualenv pip hypothesis pytest_xdist pytest ]);
env = python37.withPackages (ps: with ps; [ myPytest-bdd myProxmoxer jmespath virtualenv pip hypothesis pytest_xdist pytest ]);
in
stdenv.mkDerivation {
name = "alt-infra-ansible";

buildInputs = [
env
openssh
ansible
myPython
myAnsible
pass
];
}