"""Generic Fabric-commands which should be usable without further configuration"""
from fabric.api import *
from os.path import dirname, split, abspath
import os
import sys
import glob


# Hacking our way into __init__.py of current package
current_dir = dirname(abspath(__file__))
sys_path, package_name = split(current_dir)

sys.path.append(sys_path)
__import__(package_name, globals(), locals(), [], -1)
__package__ = package_name
from . import *

env.roledefs = hostinfo.load_roledefs()

"""Generic Fabric-commands which should be usable without further configuration"""
from fabric.api import *
from os.path import dirname, split, abspath
import os
import sys
import glob


# Hacking our way into __init__.py of current package
current_dir = dirname(abspath(__file__))
sys_path, package_name = split(current_dir)

sys.path.append(sys_path)
__import__(package_name, globals(), locals(), [], -1)
__package__ = package_name
from . import *

try:
    open("roledefs.pickle")
    env.roledefs = hostinfo.load_roledefs()
except IOError:
    pass

Allow running tasks even if roledefs.pickle is missing
Allow running tasks even if roledefs.pickle is missing

Signed-off-by: Samuli Seppänen <be49b59234361de284476e9a2215fb6477f46673@openvpn.net>

  """Generic Fabric-commands which should be usable without further configuration"""
  from fabric.api import *
  from os.path import dirname, split, abspath
  import os
  import sys
  import glob
  
  
  # Hacking our way into __init__.py of current package
  current_dir = dirname(abspath(__file__))
  sys_path, package_name = split(current_dir)
  
  sys.path.append(sys_path)
  __import__(package_name, globals(), locals(), [], -1)
  __package__ = package_name
  from . import *
  
+ try:
+     open("roledefs.pickle")
- env.roledefs = hostinfo.load_roledefs()
+     env.roledefs = hostinfo.load_roledefs()
+ except IOError:
+     pass
  
Allow running tasks even if roledefs.pickle is missing
## Code Before:
"""Generic Fabric-commands which should be usable without further configuration"""
from fabric.api import *
from os.path import dirname, split, abspath
import os
import sys
import glob


# Hacking our way into __init__.py of current package
current_dir = dirname(abspath(__file__))
sys_path, package_name = split(current_dir)

sys.path.append(sys_path)
__import__(package_name, globals(), locals(), [], -1)
__package__ = package_name
from . import *

env.roledefs = hostinfo.load_roledefs()

## Instruction:
Allow running tasks even if roledefs.pickle is missing
## Code After:
"""Generic Fabric-commands which should be usable without further configuration"""
from fabric.api import *
from os.path import dirname, split, abspath
import os
import sys
import glob


# Hacking our way into __init__.py of current package
current_dir = dirname(abspath(__file__))
sys_path, package_name = split(current_dir)

sys.path.append(sys_path)
__import__(package_name, globals(), locals(), [], -1)
__package__ = package_name
from . import *

try:
    open("roledefs.pickle")
    env.roledefs = hostinfo.load_roledefs()
except IOError:
    pass
