github.com/swiftstack/proxyfs@v0.0.0-20201223034610-5434d919416e/cookbooks/swift/recipes/source.rb (about)

     1  # Copyright (c) 2015 SwiftStack, Inc.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #    http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    12  # implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  
    17  # ensure source_root
    18  
    19  directory "#{node['source_root']}" do
    20    owner "#{node['swift_user']}"
    21    group "#{node['swift_group']}"
    22    action :create
    23  end
    24  
    25  # python install
    26  
    27  execute "git python-swiftclient" do
    28    cwd "#{node['source_root']}"
    29    command "sudo -u #{node['swift_user']} git clone -b #{node['swiftclient_repo_branch']} #{node['swiftclient_repo']}"
    30    creates "#{node['source_root']}/python-swiftclient"
    31    action :run
    32  end
    33  
    34  execute "git swift-bench" do
    35    cwd "#{node['source_root']}"
    36    command "sudo -u #{node['swift_user']} git clone -b #{node['swift_bench_repo_branch']} #{node['swift_bench_repo']}"
    37    creates "#{node['source_root']}/swift-bench"
    38    action :run
    39  end
    40  
    41  execute "git swift" do
    42    cwd "#{node['source_root']}"
    43    command "sudo -u #{node['swift_user']} git clone -b #{node['swift_repo_branch']} #{node['swift_repo']}"
    44    creates "#{node['source_root']}/swift"
    45    action :run
    46  end
    47  
    48  execute "fix semantic_version error from testtools" do
    49    command "pip install --upgrade testtools"
    50  end
    51  
    52  execute "python-swiftclient-install" do
    53    cwd "#{node['source_root']}/python-swiftclient"
    54    command "pip install -e . && pip install -r test-requirements.txt"
    55    if not node['full_reprovision']
    56      creates "/usr/local/lib/python2.7/dist-packages/python-swiftclient.egg-link"
    57    end
    58    action :run
    59  end
    60  
    61  execute "swift-bench-install" do
    62    cwd "#{node['source_root']}/swift-bench"
    63    # swift-bench has an old version of hacking in the test requirements,
    64    # seems to pull back pbr to 0.11 and break everything; not installing
    65    # swift-bench's test-requirements is probably better than that
    66    command "pip install -e ."
    67    if not node['full_reprovision']
    68      creates "/usr/local/lib/python2.7/dist-packages/swift-bench.egg-link"
    69    end
    70    action :run
    71  end
    72  
    73  execute "python-swift-install" do
    74    cwd "#{node['source_root']}/swift"
    75    command "pip install -e . && pip install -r test-requirements.txt"
    76    if not node['full_reprovision']
    77      creates "/usr/local/lib/python2.7/dist-packages/swift.egg-link"
    78    end
    79    action :run
    80  end
    81  
    82  execute "install tox" do
    83    command "pip install tox==3.5.3"
    84    if not node['full_reprovision']
    85      creates "/usr/local/lib/python2.7/dist-packages/tox"
    86    end
    87    action :run
    88  end
    89  
    90  [
    91    'swift',
    92    'python-swiftclient',
    93  ].each do |dirname|
    94    execute "ln #{dirname}" do
    95      command "ln -s #{node['source_root']}/#{dirname} /home/#{node['swift_user']}/#{dirname}"
    96      creates "/home/#{node['swift_user']}/#{dirname}"
    97    end
    98  end
    99