mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
Add `assets' variable to task __init__ files
This commit is contained in:
parent
af2397720d
commit
2b5664b0b2
8 changed files with 21 additions and 9 deletions
|
@ -0,0 +1,3 @@
|
|||
import os.path
|
||||
|
||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
|
@ -2,6 +2,7 @@ from base import Task
|
|||
from common import phases
|
||||
from common.exceptions import TaskError
|
||||
from common.tools import log_check_call
|
||||
from . import assets
|
||||
import os.path
|
||||
|
||||
|
||||
|
@ -31,7 +32,7 @@ class AddExpandRoot(Task):
|
|||
successors = [InstallInitScripts]
|
||||
|
||||
def run(self, info):
|
||||
init_scripts_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets/init.d'))
|
||||
init_scripts_dir = os.path.join(assets, 'init.d')
|
||||
info.initd['install']['expand-root'] = os.path.join(init_scripts_dir, 'expand-root')
|
||||
|
||||
|
||||
|
@ -41,7 +42,7 @@ class AddSSHKeyGeneration(Task):
|
|||
successors = [InstallInitScripts]
|
||||
|
||||
def run(self, info):
|
||||
init_scripts_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets/init.d'))
|
||||
init_scripts_dir = os.path.join(assets, 'init.d')
|
||||
install = info.initd['install']
|
||||
from subprocess import CalledProcessError
|
||||
try:
|
||||
|
|
|
@ -3,6 +3,8 @@ from common import phases
|
|||
from common.tasks.locale import GenerateLocale
|
||||
import os
|
||||
|
||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
||||
|
||||
|
||||
class OpenNebulaContext(Task):
|
||||
description = 'Setup OpenNebula init context'
|
||||
|
@ -16,8 +18,7 @@ class OpenNebulaContext(Task):
|
|||
stat.S_IROTH | stat.S_IXOTH)
|
||||
|
||||
from shutil import copy
|
||||
assets_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
||||
script_src = os.path.join(assets_dir, 'one-context_3.8.1.deb')
|
||||
script_src = os.path.join(assets, 'one-context_3.8.1.deb')
|
||||
script_dst = os.path.join(info.root, 'tmp/one-context_3.8.1.deb')
|
||||
copy(script_src, script_dst)
|
||||
os.chmod(script_dst, rwxr_xr_x)
|
||||
|
@ -34,11 +35,11 @@ class OpenNebulaContext(Task):
|
|||
'90', '2', '3', '4', '5', 'stop', '90', '0', '6'])
|
||||
|
||||
# Load all pubkeys in root authorized_keys
|
||||
script_src = os.path.join(assets_dir, 'one-pubkey.sh')
|
||||
script_src = os.path.join(assets, 'one-pubkey.sh')
|
||||
script_dst = os.path.join(info.root, 'etc/one-context.d/one-pubkey.sh')
|
||||
copy(script_src, script_dst)
|
||||
|
||||
# If USER_EC2_DATA is a script, execute it
|
||||
script_src = os.path.join(assets_dir, 'one-ec2.sh')
|
||||
script_src = os.path.join(assets, 'one-ec2.sh')
|
||||
script_dst = os.path.join(info.root, 'etc/one-context.d/one-ec2.sh')
|
||||
copy(script_src, script_dst)
|
||||
|
|
|
@ -5,6 +5,7 @@ from common.tasks import apt
|
|||
from plugins.admin_user.tasks import CreateAdminUser
|
||||
import os
|
||||
import shutil
|
||||
|
||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), 'assets'))
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import os.path
|
||||
|
||||
assets = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets'))
|
|
@ -5,9 +5,10 @@ from common.tools import log_check_call
|
|||
from ebs import Snapshot
|
||||
from common.tasks import workspace
|
||||
from connection import Connect
|
||||
from . import assets
|
||||
import os.path
|
||||
|
||||
cert_ec2 = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets/certs/cert-ec2.pem'))
|
||||
cert_ec2 = os.path.join(assets, 'certs/cert-ec2.pem')
|
||||
|
||||
|
||||
class AMIName(Task):
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
from base import Task
|
||||
from common import phases
|
||||
from . import assets
|
||||
import os
|
||||
|
||||
|
||||
|
@ -19,7 +20,7 @@ class ConfigurePVGrub(Task):
|
|||
os.chmod(cfg, os.stat(cfg).st_mode & ~ x_all)
|
||||
|
||||
from shutil import copy
|
||||
script_src = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets/grub.d/40_custom'))
|
||||
script_src = os.path.join(assets, 'grub.d/40_custom')
|
||||
script_dst = os.path.join(info.root, 'etc/grub.d/40_custom')
|
||||
copy(script_src, script_dst)
|
||||
os.chmod(script_dst, rwxr_xr_x)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from base import Task
|
||||
from common import phases
|
||||
from common.tasks import initd
|
||||
from . import assets
|
||||
import os.path
|
||||
|
||||
|
||||
|
@ -13,6 +14,6 @@ class AddEC2InitScripts(Task):
|
|||
init_scripts = {'ec2-get-credentials': 'ec2-get-credentials',
|
||||
'ec2-run-user-data': 'ec2-run-user-data'}
|
||||
|
||||
init_scripts_dir = os.path.normpath(os.path.join(os.path.dirname(__file__), '../assets/init.d'))
|
||||
init_scripts_dir = os.path.join(assets, 'init.d')
|
||||
for name, path in init_scripts.iteritems():
|
||||
info.initd['install'][name] = os.path.join(init_scripts_dir, path)
|
||||
|
|
Loading…
Add table
Reference in a new issue