This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def FtpRmTree(ftp, path): | |
"""Recursively delete a directory tree on a remote server.""" | |
wd = ftp.pwd() | |
try: | |
names = ftp.nlst(path) | |
except ftplib.all_errors as e: | |
# some FTP servers complain when you try and list non-existent paths | |
_log.debug('FtpRmTree: Could not remove {0}: {1}'.format(path, e)) | |
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CSVToMap takes a reader and returns an array of dictionaries, using the header row as the keys | |
func CSVToMap(reader io.Reader) []map[string]string { | |
r := csv.NewReader(reader) | |
rows := []map[string]string{} | |
var header []string | |
for { | |
record, err := r.Read() | |
if err == io.EOF { | |
break | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
write_files: | |
- path: /etc/systemd/system/docker.service.d/docker.conf | |
content: | | |
[Service] | |
ExecStart= | |
ExecStart=/usr/bin/dockerd | |
- path: /etc/docker/daemon.json | |
content: | |