Cleaned pep8.

Change-Id: Idb50257fb6b33afa21be25870d17fc0cbf31983a
This commit is contained in:
Monty Taylor 2011-07-25 11:35:20 -04:00
parent 147341f692
commit ec2d141cab
3 changed files with 59 additions and 54 deletions

View File

@ -1,8 +1,9 @@
import sys, subprocess
import sys
import subprocess
from launchpadlib.launchpad import Launchpad
from launchpadlib.uris import LPNET_SERVICE_ROOT
cachedir="~/.launchpadlib/cache"
cachedir = "~/.launchpadlib/cache"
launchpad = Launchpad.login_with('Sync Users', LPNET_SERVICE_ROOT, cachedir)
@ -12,13 +13,13 @@ def get_type(in_type):
else:
return "ssh-dsa"
for team_todo in ('openstack-ci-admins','openstack-admins'):
team_underscores = team_todo.replace('-','_')
for team_todo in ('openstack-ci-admins', 'openstack-admins'):
team_underscores = team_todo.replace('-', '_')
team = launchpad.people[team_todo]
details = [detail for detail in team.members_details]
users=[]
users = []
with open("manifests/%s_users.pp" % team_underscores, "w") as user_pp:
user_pp.write("""
@ -29,16 +30,21 @@ class %s_users {
sudo = True
member = detail.member
status = detail.status
if (status == "Approved" or status == "Administrator") and member.is_valid:
full_name = member.display_name.replace("'","\\'")
if (status == "Approved" or status == "Administrator") \
and member.is_valid:
full_name = member.display_name.replace("'", "\\'")
login_name = member.name
ssh_keys = "\\n".join(["%s %s %s" % (get_type(key.keytype), key.keytext, key.comment) for key in member.sshkeys])
ssh_keys = ssh_keys.replace("\n","\\n")
ssh_keys = "\\n".join(["%s %s %s" % (get_type(key.keytype),
key.keytext, key.comment) for key in member.sshkeys])
ssh_keys = ssh_keys.replace("\n", "\\n")
for nick in member.irc_nicknames:
if nick.network == 'ci.openstack.org':
login_name = nick.nickname
auth_content = "[Launchpad]\\nhost = .launchpad.net\\n" + \
"scheme = ssh\\nuser = %s\\n" % member.name
user_pp.write("""
group { '%(login_name)s':
ensure => 'present'
@ -69,8 +75,8 @@ class %s_users {
mode => 644,
ensure => 'directory',
}
file { '%(login_name)ssshdir':
name => $operatingsystem ? {
Darwin => '/Users/%(login_name)s/.ssh',
@ -163,14 +169,13 @@ class %s_users {
owner => '%(login_name)s',
group => '%(login_name)s',
mode => 640,
content => "[Launchpad]\\nhost = .launchpad.net\\nscheme = ssh\\nuser = %(member_name)s\\n",
content => "%(auth_content)s",
ensure => 'present',
require => File['%(login_name)sbazaardir'],
}
""" % dict(login_name=login_name, full_name=full_name, ssh_keys=ssh_keys,
member_name=member.name))
member_name=member.name, auth_content=auth_content))
print "User=%s created" % login_name
user_pp.write("""

View File

@ -1,7 +1,7 @@
class openstack_admins_users {
include sudoers
include sudoers
group { 'corvus':
ensure => 'present'
}
@ -31,8 +31,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'corvussshdir':
name => $operatingsystem ? {
Darwin => '/Users/corvus/.ssh',
@ -160,8 +160,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'jaypipessshdir':
name => $operatingsystem ? {
Darwin => '/Users/jaypipes/.ssh',
@ -289,8 +289,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'john-purriersshdir':
name => $operatingsystem ? {
Darwin => '/Users/john-purrier/.ssh',
@ -418,8 +418,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'mordredsshdir':
name => $operatingsystem ? {
Darwin => '/Users/mordred/.ssh',
@ -547,8 +547,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'dendrobatessshdir':
name => $operatingsystem ? {
Darwin => '/Users/dendrobates/.ssh',
@ -676,8 +676,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'sorensshdir':
name => $operatingsystem ? {
Darwin => '/Users/soren/.ssh',
@ -805,8 +805,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'ttxsshdir':
name => $operatingsystem ? {
Darwin => '/Users/ttx/.ssh',
@ -934,8 +934,8 @@ class openstack_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'wreesesshdir':
name => $operatingsystem ? {
Darwin => '/Users/wreese/.ssh',

View File

@ -1,7 +1,7 @@
class openstack_ci_admins_users {
include sudoers
include sudoers
group { 'annegentle':
ensure => 'present'
}
@ -31,8 +31,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'annegentlesshdir':
name => $operatingsystem ? {
Darwin => '/Users/annegentle/.ssh',
@ -160,8 +160,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'dan-princesshdir':
name => $operatingsystem ? {
Darwin => '/Users/dan-prince/.ssh',
@ -289,8 +289,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'edaysshdir':
name => $operatingsystem ? {
Darwin => '/Users/eday/.ssh',
@ -418,8 +418,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'corvussshdir':
name => $operatingsystem ? {
Darwin => '/Users/corvus/.ssh',
@ -547,8 +547,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'jaypipessshdir':
name => $operatingsystem ? {
Darwin => '/Users/jaypipes/.ssh',
@ -676,8 +676,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'heckjsshdir':
name => $operatingsystem ? {
Darwin => '/Users/heckj/.ssh',
@ -805,8 +805,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'mordredsshdir':
name => $operatingsystem ? {
Darwin => '/Users/mordred/.ssh',
@ -934,8 +934,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'santosh-jodh-8sshdir':
name => $operatingsystem ? {
Darwin => '/Users/santosh-jodh-8/.ssh',
@ -1063,8 +1063,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'sorensshdir':
name => $operatingsystem ? {
Darwin => '/Users/soren/.ssh',
@ -1192,8 +1192,8 @@ class openstack_ci_admins_users {
mode => 644,
ensure => 'directory',
}
file { 'ttxsshdir':
name => $operatingsystem ? {
Darwin => '/Users/ttx/.ssh',