Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixops
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 29ae4b6e072a
Choose a base ref
...
head repository: NixOS/nixops
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 45372870875d
Choose a head ref
Loading
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ language: nix
before_script:
- sudo echo 'sandbox = true' | sudo tee /etc/nix/nix.conf
script:
- nix-shell -p python3Packages.black --run "black . --check --diff"
- nix-shell --run "mypy nixops"
- nix-shell --run "black . --check --diff"
- ./dev-shell --run "./coverage-tests.py -a '!libvirtd,!gce,!ec2,!azure' -v"
- nix-build --quiet release.nix -A build.x86_64-linux -I nixpkgs=channel:nixos-19.03
- nix-build --quiet release.nix -A build.x86_64-linux -I nixpkgs=channel:nixos-19.09
9 changes: 4 additions & 5 deletions maintainers/dump-route53-hosted-zone.py
Original file line number Diff line number Diff line change
@@ -19,13 +19,11 @@
by_hostname = {}
for record in records:
name = record["Name"]
if not name in by_hostname:
if name not in by_hostname:
by_hostname[name] = []
by_hostname[name].append(record)

count = {
k: len([x for x in v if x["Type"] == "A"]) for (k, v) in list(by_hostname.items())
}
count = {k: sum(1 for x in v if x["Type"] == "A") for (k, v) in by_hostname.items()}


def print_record(record):
@@ -93,6 +91,7 @@ def print_record(record):
)
)
print(" resources.route53RecordSets = {")
list(map(print_record, records))
for record in records:
print_record(record)
print(" };")
print("}")
17 changes: 17 additions & 0 deletions nixops/ansi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import sys


def ansi_highlight(s: str, outfile=sys.stderr) -> str:
return "\033[1;35m" + s + "\033[0m" if outfile.isatty() else s


def ansi_warn(s: str, outfile=sys.stderr) -> str:
return "\033[1;33m" + s + "\033[0m" if outfile.isatty() else s


def ansi_error(s: str, outfile=sys.stderr) -> str:
return "\033[1;31m" + s + "\033[0m" if outfile.isatty() else s


def ansi_success(s: str, outfile=sys.stderr) -> str:
return "\033[1;32m" + s + "\033[0m" if outfile.isatty() else s
8 changes: 6 additions & 2 deletions nixops/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import os
import re
import subprocess

from typing import Dict, Any
import nixops.util
import nixops.resources
import nixops.ssh_util
@@ -208,6 +208,10 @@ def remove_backup(self, backup_id, keep_physical=False):
"don't know how to remove a backup for machine ‘{0}’".format(self.name)
)

def get_backups(self) -> Dict[str, Dict[str, Any]]:
self.warn("don't know how to list backups for ‘{0}’".format(self.name))
return {}

def backup(self, defn, backup_id):
"""Make backup of persistent disks, if possible."""
self.warn(
@@ -263,7 +267,7 @@ def send_keys(self):
return
if self.store_keys_on_machine:
return
for k, opts in list(self.get_keys().items()):
for k, opts in self.get_keys().items():
self.log("uploading key ‘{0}’...".format(k))
tmp = self.depl.tempdir + "/key-" + self.name
if "destDir" not in opts:
Loading